ABP Localization Language


The localized key names are arbitrary. You can set any name. However, there are some conventions for specific types of text:

  1. Add the prefix Menu: to menu items.
  2. Use the naming convention <enum-type>.<enum-value> or Enum:<enum-type>.<enum-value> to localize enum members. When you do this, ABP can automatically locate the enum in some appropriate cases.


Set Default Localization Language#

Because ABP comes with many language packs, but we don't need so many languages. Generally, there are only two languages, English and Chinese. The rest need to be deleted. But for Chinese, there are many branches. How do you determine what your localization language is? Determine it by executing navigator.language in the browser. For example, if my output result is zh-CN, it means that the json language pack file with culture set to zh-CN will be used, such as zh-CN.json. This whole process is automated and does not require any configuration. Just be careful not to delete the language pack of your culture, otherwise only English will be displayed.

I previously wanted to specify a default culture for the project, but it was not successful. The methods I have used include:

  • Configuring in the XXW.XXX.Domain.Shared project's XXDomainSharedModule.ConfigureServices function:
    // Add localization and specify the default localization language
  • Configuring the following content in the appsettings.json file of the *.Web project:
  "Settings": {
    "Abp.Localization.DefaultLanguage": "zh-CN"

It is also possible that the default localization language is set in the AbpSettingDefinitions table in the database when initializing data. I accidentally saw that it has not been changed, so you can try changing it:

There is another way, which is to use

I haven't used it yet.


Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.