The requested page is not available for the requested platform. You are viewing the content for Default platform.

Localize WPF Dashboard Control

The topic describes how to localize different UI elements such as dialog boxes, button captions, menu items, and error messages. You can localize the WPF Dashboard Control's user interface with satellite resource assemblies and localizer objects.

Tip

See the main Localization topic for information on how to localize culture-specific data.

Satellite Resource Assemblies

To localize the WPF Dashboard Control, add satellite assemblies to your application and specify the culture in code.

Obtain and Add Satellite Assemblies

Use the DevExpress Localization Service to obtain satellite assemblies for DevExpress .NET controls that correspond to other cultures. Copy the folders (for example, de) that contain satellite assemblies to the application's EXE file directory.

Refer to Localize WPF controls via Satellite Resource Assemblies for a detailed guide.

Specify a Culture Different from the System Culture

Assign the required culture's abbreviation to the CurrentThread.CurrentUICulture and CurrentThread.CurrentCulture properties to specify a culture for your dashboard application:

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(); 
        // ...
        } 
    } 
} 

Localizer Objects

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.

Important

We recommend localization via 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:

  1. Create a DashboardLocalizer descendant and override the GetLocalizedString method (which returns a string for a specified string resource identifier) or the PopulateStringTable method.

  2. 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.

  1. Implement a Localizer descendant:
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);
            }
        }
    }

Instantiate the custom localizer and assign it to the static Active property of the base class.

using 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.

See the following topic for general information: Localize WPF controls via Localizer Objects