Search code examples
c#localizationmicroservicesabp-framework

How to remove preinstalled languages in ABP framework in microservice template?


I use microservice template and language management module. It adds about 10 different languages and I want to have only 2. I tried to limit it using AbpLocalizationOptions but it didn't help.

I tried to write the following code in my Shared Localization module

Configure<AbpLocalizationOptions>(options =>
{
    options.Languages.Clear(); // Clear existing languages to redefine them

    options.Languages.Add(new LanguageInfo("en", "en", "English"));
    options.Languages.Add(new LanguageInfo("de", "de", "Deutsch"));

});

Also, tried to remove everything from database directly, but they come back after restarting the app.

Using version 7.4.5


Solution

  • Localization languages are defined in the AdministrationServiceDomainModule (under services/administration folders). So, you can configure the localization languages there.

    Alternatively, you can configure the localization languages in your final application. For example, if you selected the MVC UI, you can configure the localization in the MyProjectNameWebModule (under apps/web folders), or for Blazor MyProjectNameBlazorModule (under apps/blazor folders):

    Configure<AbpLocalizationOptions>(options =>
    {
        options.Languages.Clear();
    
        options.Languages.Add(new LanguageInfo("en", "en", "English"));
        options.Languages.Add(new LanguageInfo("de", "de", "Deutsch"));
    
    });