Search code examples
c#configurationlocalizationsettingsaspnetboilerplate

How to change ABP default language?


I'm new to using ASP.NET Boilerplate and I want to change the default language to Spanish. I saw that there are some XML files (localizationSources) and I've changed the LocalizationSourceName in AppConsts to point to the es XML file, but messages still appear in English.

I've read the ABP documentation, but it is very abstract for me as I'm new to using ABP.

Note: My English is not very good.


Solution

  • Inject ISettingManager and change the setting:

    await SettingManager.ChangeSettingForApplicationAsync(LocalizationSettingNames.DefaultLanguage, "en");
    

    The value is used as described in How the Current Language is Determined.