Localization

Overview
The Localization module switches the system interface between languages. It is based on BootstrapBlazor's localization mechanism: the CultureChooser component in the upper-right corner selects the language, and the change takes effect immediately without restarting the application.
For a front office split by URL (/Feedback in Chinese, /en-US/Feedback in English), turn on EnableLangRoute — see Language Routing. For business data that stores different content per language, see Localized Data.
Usage
Enabling Localization
Configure in Program.cs:
builder.AddEasyAdminBlazor(new EasyAdminBlazorOptions
{
EnableLocalization = true,
...
});
Switching Languages
Click the target language in the language selector at the upper-right corner of the page, and the interface language switches immediately.
Adding a New Language
No code modification is needed. Simply add the corresponding translation resources to the language resource files. BootstrapBlazor will automatically read and display the available language options.
Language packs live in two places:
- Main pack:
EasyAdminBlazor/Locales/{culture}.json, root nodeEasyAdminBlazor.Common, for text shared by the framework and several extensions; - Extension pack:
Extensions/EasyAdminBlazor.{Extension}/Locales/{culture}.json, also using theEasyAdminBlazor.Commonroot node, for text and entity blocks specific to that extension. When the extension callsAddEasyAdminBlazorAssembly, the framework adds it toJsonLocalizationOptions.AdditionalJsonAssembliesand merges it intoCommonLocalizer. The repository-levelDirectory.Build.targetsembedsLocales/*.jsonautomatically; standalone projects need the explicit csproj items.
Add a language in both places. If an extension does not provide a culture, the main pack (and finally the Chinese key itself) is used as a fallback.
Configuration
Supported languages and the default language are configured in appsettings.json:
"BootstrapBlazorOptions": {
"DefaultCultureInfo": "zh-CN",
"SupportedCultures": [ "zh-CN", "en-US" ]
}
When either EnableLocalization or EnableLangRoute is on, uncomment this block in Program.cs:
var option = app.Services.GetService<IOptions<RequestLocalizationOptions>>();
if (option != null)
{
app.UseRequestLocalization(option.Value);
}
The language of each request is decided in the order URL prefix (only with EnableLangRoute) → cookie → Accept-Language, first non-null result wins; parent culture codes fall back (en → en-US). With both switches off request localization is not enabled and the language is the thread's default culture.
Related Components/Services
CultureChooser— Language switching UI componentCommonLocalizer— Text lookup service,CommonLocalizer["Chinese key"], falling back to the key itself when untranslatedBootstrapBlazorOptions— Configures the supported language list and the default languageILangUrl— Adds the language prefix to front-office links, see Language Routing