dashboard-400835-wpf-viewer-localization.md
You can localize your applications - update their UI to match certain culture and language settings:
You can localize the WPF Dashboard Control’s user interface with satellite resource assemblies and localizer objects.
To localize the WPF Dashboard Control, add satellite assemblies to your application and specify the culture in code.
The .NET Products Installer includes resource assemblies for a set of languages. It registers these assemblies into the GAC (Global Assembly Cache) of your development machine, and also places them in the installation folder (the default path is C:\Program Files\DevExpress 25.2\Components\Bin\Framework\). You can find these assemblies within the following subfolders:
| Subfolder name | Culture |
|---|---|
| de | German |
| es | Spanish |
| ja | Japanese |
To download satellite assemblies for other cultures, use the DevExpress Localization Service. This service allows you to modify existing translations, and compile and download satellite assemblies.
Modules to translate:
Copy the folders (for example, es or de ) that contain satellite assemblies to the application’s EXE file directory.
Refer to the following topic for a detailed guide: Localize WPF controls using Satellite Resource Assemblies
Assign the required culture’s abbreviation to the CurrentThread.CurrentUICulture and CurrentThread.CurrentCulture properties before the InitializeComponent method:
public partial class MainWindow: ThemedWindow {
public Form1() {
var culture = System.Globalization.CultureInfo.CreateSpecificCulture("de-DE");
System.Threading.Thread.CurrentThread.CurrentCulture = culture;
System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
InitializeComponent();
// ...
}
}
}
Partial Public Class MainWindow
Inherits ThemedWindow
Public Sub New()
Dim culture As CultureInfo = System.Globalization.CultureInfo.CreateSpecificCulture("de-DE")
System.Threading.Thread.CurrentThread.CurrentCulture = culture
System.Threading.Thread.CurrentThread.CurrentUICulture = culture
InitializeComponent()
' ...
End Sub
End Class
Localization means translating UI texts into a different language. The DevExpress WPF Dashboard control can use the DashboardLocalizer descendant to change localizable texts at runtime. This approach can be useful when a resource value is not known at design time, or if you need to set the resource value based on a runtime condition.
Use the following localizer objects to translate resources:
Important
We recommend you to localize UI using resources because some components contain form resources, which should be translated with satellite assemblies. Use the Localizer classes to translate particular strings.
Follow the steps below to localize the DashboardControl:
Create a DashboardLocalizer descendant and override the GetLocalizedString method (which returns a string for a specified string resource identifier) or the PopulateStringTable method.
Assign an instance of this class to the static DashboardLocalizer.Active property.
The following example demonstrates how to localize the Dashboard control UI into Spanish.
using DevExpress.DashboardCommon.Localization;
// ...
public class MySpanishDashboardLocalizer : DashboardLocalizer
{
public override string Language { get { return "Español"; } }
public override string GetLocalizedString(DashboardStringId id)
{
switch (id)
{
// ...
case DashboardStringId.ActionExportToImage: return "Exportar a";
case DashboardStringId.ActionExportToPdf: return "Exportar a imagen";
case DashboardStringId.ActionMaximizeDashboardItem: return "Maximizar";
// ...
default:
return base.GetLocalizedString(id);
}
}
}
Imports DevExpress.DashboardCommon.Localization
' ...
Public Class MySpanishDashboardLocalizer
Inherits DashboardLocalizer
Public Overrides ReadOnly Property Language() As String
Get
Return "Español"
End Get
End Property
Public Overrides Function GetLocalizedString(ByVal id As DashboardStringId) As String
Select Case id
' ...
Case DashboardStringId.ActionExportToImage
Return "Exportar a"
Case DashboardStringId.ActionExportToPdf
Return "Exportar a imagen"
Case DashboardStringId.ActionMaximizeDashboardItem
Return "Maximizar"
' ...
Case Else
Return MyBase.GetLocalizedString(id)
End Select
End Function
End Class
Instantiate the custom localizer and assign it to the static Active property of the base class.
using DevExpress.DashboardCommon.Localization;
// ...
DashboardLocalizer.Active = new MySpanishDashboardLocalizer();
Imports DevExpress.DashboardCommon.Localization
' ...
DashboardLocalizer.Active = New MySpanishDashboardLocalizer()
Tip
You can use a simple application WPF Dashboard Localized String ID Visualizer to determine the correct name of the localized string ID enumeration member.
View Example: WPF Dashboard Control - Localized String ID Visualizer
See the following topic for general information: Localize WPF controls using Localizer Objects.
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.
For more information refer to the following topic: UI Localization Client.
Use the following members to specify the currency settings: