You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.3 KiB
2.3 KiB
LINGYUN.Abp.Localization.CultureMap
Module Description
This module solves localization issues with multiple culture format variants. It allows you to map different culture format identifiers to a standard format.
Reference Project: Owl.Abp.CultureMap
Features
- Support mapping multiple culture format identifiers to standard format
- Support independent mapping for Culture and UICulture
- Integration with ABP request localization
- Support custom culture mapping rules
Installation
dotnet add package LINGYUN.Abp.Localization.CultureMap
Base Modules
- Volo.Abp.AspNetCore
Configuration
The module provides the following configuration options:
- CulturesMaps: List of culture mappings
- UiCulturesMaps: List of UI culture mappings
Each mapping item contains:
- TargetCulture: Target culture identifier
- SourceCultures: List of source culture identifiers
Usage
- Add module dependency:
[DependsOn(
typeof(AbpLocalizationCultureMapModule))]
public class YouProjectModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpLocalizationCultureMapOptions>(options =>
{
var zhHansCultureMapInfo = new CultureMapInfo
{
TargetCulture = "zh-Hans",
SourceCultures = new string[] { "zh", "zh_CN", "zh-CN" }
};
options.CulturesMaps.Add(zhHansCultureMapInfo);
options.UiCulturesMaps.Add(zhHansCultureMapInfo);
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
app.UseMapRequestLocalization();
}
}
Common Use Cases
- Unify Simplified Chinese culture identifiers:
options.CulturesMaps.Add(new CultureMapInfo
{
TargetCulture = "zh-Hans",
SourceCultures = new string[] { "zh", "zh_CN", "zh-CN" }
});
- Unify Traditional Chinese culture identifiers:
options.CulturesMaps.Add(new CultureMapInfo
{
TargetCulture = "zh-Hant",
SourceCultures = new string[] { "zh_TW", "zh-TW", "zh_HK", "zh-HK" }
});