Search code examples
localizationaspnetboilerplateabp-framework

Abp boilerplate Localization by QueryStringRequestCultureProvider for custom language


I try to use localization method L() in MyController for getting localization string from my custom added language(not standart for boilerplate - swedish).

Regarding to documentation (https://aspnetboilerplate.com/Pages/Documents/Localization) I can add queryStringParameter to request culture=sv (my source localization file is Abp-sv.xml) I added this parameter but L("SomeString) returns localization for default language.

If I use culture for standart ASP.NET Boilerplate languages ar, de, etc. then it works.


Solution

  • Thanks for @aaron It didn't work because my DB doesn't include row with my custom language. queryStringParameter works just in case if you add your language to application. You can do it just by this code

    Configuration.Localization.Languages.Add(new LanguageInfo("en", "English", "famfamfam-flags gb", true));
    

    Or as in my case, by adding it to DB, and abp'll add it in your application.