aspnetboilerplate: localization not work when disable one of languages

@demirmusa I download new template from the site and issue still there image

i updated these files like below image image

but as you can see issue still there image

is there something wrong i did in my modifications? is there something i need to add to make localization work?

I think solution maybe to change this part in the code in line 83 of this file (https://github.com/aspnetboilerplate/aspnetboilerplate/pull/5670/commits/d2e552c0825ee635548b2ba4996b5e5c3dda050d#diff-16a7725abffda170921fb5b428593585)

var internalDictionary =
                _internalProvider.Dictionaries.GetOrDefault(language.Name) ??
                new EmptyDictionary(CultureInfo.GetCultureInfo(language.Name));

to something like this

var internalDictionary =
                _internalProvider.Dictionaries.GetOrDefault(language.Name) ??
                //maybe you need to add this line and send 2 left letter e.g. en-GB then you send en as parameter
               _internalProvider.Dictionaries.GetOrDefault(string.left(language.Name,2)) ??
                new EmptyDictionary(CultureInfo.GetCultureInfo(language.Name));

image

_Originally posted by @sajasbana in https://github.com/aspnetboilerplate/aspnetboilerplate/issues/5194#issuecomment-654295155_

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

@demirmusa i wrote steps in the post you just need to modify the 2 classes in seed DefaultLanguagesCreator.cs and DefaultSettingsCreator.cs as same as in the post images

I downloaded new project again and test it and issue still there, I shared with you the project so you can see the changes and run to see the issue https://drive.google.com/drive/folders/1E_RzIvWpzfO32f4TfpZafmb4kX9kmceU?usp=sharing

please make sure to clean the cookie and cache also change default language in DefaultSettingsCreator.cs to be ‘en-GB’

Thanks