Skip to main content
A newer version of this page is available. .

How to: Localize the WPF Dashboard Control with Localizer Object

  • 2 minutes to read

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 Also