dashboard-402535-web-dashboard-integrate-dashboard-component-aspnet-core-dashboard-control-localization.md
You can localize your applications - update their UI to match certain culture and language settings:
View Example: Dashboard for ASP.NET Core - Localization
For ASP.NET Core 6+, localize an ASP.NET Core Dashboard application with satellite resource assemblies.
We published NuGet packages with predefined satellite resource assemblies for the following cultures:
GermanDevExpress.AspNetCore.Dashboard.deSpanishDevExpress.AspNetCore.Dashboard.esJapaneseDevExpress.AspNetCore.Dashboard.ja
Follow the steps below to add the above-mentioned resources for cultures:
You can add the assemblies for other cultures to your ASP.NET Core application. Follow the steps below to add the resources for French (fr culture):
Go to the DevExpress Localization Service to download satellite assemblies for DevExpress .NET controls that correspond to other cultures. Ensure that the version of the satellite assemblies (for instance, v20.2) matches the version of the DevExpress Dashboard package in the project.
Create a subdirectory in the application’s EXE file directory (usually in the bin\Debug\netX.X\ subdirectory) with the name that corresponds to the newly generated resource culture (for example, bin\Debug\netX.X\fr - to translate your application into French).
Unpack the archive with resources generated by the DevExpress Localization Service and copy all the *.v25.2.resources.dll files to the newly created subdirectory.
After you add assemblies, configure the Localization Middleware:
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
// ...
var supportedCultures = new[] { "en-US", "es", "fr" };
app.UseRequestLocalization(new RequestLocalizationOptions()
.SetDefaultCulture(supportedCultures[0])
.AddSupportedCultures(supportedCultures)
.AddSupportedUICultures(supportedCultures));
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseDevExpressControls();
app.UseRouting();
app.UseEndpoints(endpoints => {
endpoints.MapDashboardRoute("dashboardControl", "DefaultDashboard");
endpoints.MapRazorPages();
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
}
When you launch the application, you can pass the culture and ui-culture query string parameters to the application’s URL. The following example sets the Spanish culture:
http://localhost:5000/?culture=es&ui-culture=es
You can also specify both the language and region (for example, es-MX for Spanish/Mexico).
The UI Localization Client is a cross-platform utility that allows you to quickly identify non-translated strings of DevExpress UI controls and translate them during a debug session. The utility automatically generates a RESX file(s) with translated resources and adds it to the project. Note that the UI Localization Client loads all Web Dashboard resource strings at once, without reflecting your interaction with the UI.
For more information refer to the following topic: UI Localization Client.
The resource strings for the Web Dashboard Control are located in the following localization containers:
DevExpress.DashboardWeb.Localization.LocalizationContainerContains localization strings specific only to the Web Dashboard Control.DevExpress.Utils.Localization.CoreLibraryResourcesContains cross-platform localization strings used in the Web Dashboard Control.DevExpress.Web.Resources.Localization.LocalizationContainerContains localization strings common to DevExpress Web Components used in the Web Dashboard Control.
The ASP.NET Core Dashboard control uses Intl as a default way to apply culture-specific formatting. Intl is the short name used to refer to a particular ECMAScript Internationalization API object. The Web Dashboard supports this API out of the box. To localize date, numbers, and currencies, do the following:
locale() method and pass the locale as a parameter:The ASP.NET Core Dashboard control can use Globalize instead of Intl to format dates, numbers, and currencies.
Follow the steps below to use Globalize for culture-specific formatting:
Install the following packages:
When you bundle scripts, add the following lines to the bundleconfig.json file:
Handle the OnBeforeRender event and call the Globalize.locale() method to apply culture settings.