In December 2023 (v23.2), we released a new UI Localization Client tool designed to streamline the localization process for DevExpress-powered Blazor, WinForms, WPF, and ASP.NET apps.
The UI Localization Client allows you to locate non-translated resource strings within in your application/website, translate them, auto-generate localized resources, and preview results.
Challenges Addressed by Our UI Localization Client
The DevExpress Localization Service allows you to download localized resources generated by the DevExpress developer community. This simplifies the localization process, but community-sourced localized resources may be incomplete.
If you've used our Localization Service, you know that it can be challenging to find non-translated resource strings used in an application (the Localization Service doesn't know what resource strings are used in your application). Once you do locate non-translated strings, our current Localization Service requires that you modify strings using the Localization Service itself, build and download satellite assemblies, and re-use them in your project).
As you'll see below, our new UI Localization Client eliminates these routine and time-consuming steps/tasks.
How the New UI Localization Client Works
The UI Localization Client attaches to your application and loads only those DevExpress resource strings utilized in your application/website (when they appear in the UI at runtime). You can locate non-translated (or incorrectly translated resource strings), translate them on the go, auto-generate required RESX files, auto-add them to the project, and preview results.
Watch the following video to learn how to work with the UI Localization Client.
Features
Visual Studio Integration
Run the UI Localization Client from the Visual Studio menu:
Auto-Detect Non-Translated Resource Strings
With this option, you can locate non-translated resource strings as they appear in your application. The UI Localization Client identifies non-translated strings as they are loaded.
All you need to do is to activate source tracing at application startup:
// Do not remove the following line when using the UI Localization Client.
DevExpress.Utils.Localization.XtraLocalizer.EnableTraceSource();
The UI Localization Client attempts to automatically obtain the application name, but may be unable to do that in certain applications(for example, Web projects).You should explicitly specify the application’s unique name as a parameter to the EnableTraceSource method.Otherwise, the UI Localization client will not connect to the application.
XtraLocalizer.EnableTraceSource(applicationName: "MyApp");
Auto-Generate Localized Resources
The UI Localization Client automatically generates a RESX file with translated strings and adds it to your project. You do not need to modify resources in our Localization Service, build and download satellite assemblies, and re-use them in your project.
New Localization-Related API
The DevExpress.Utils.Localization.XtraLocalizer
class implements APIs that allow you to translate or modify shipping resources at runtime (on the fly). In v23.2, we implemented new APIs that allow you to do the following tasks.
Detect Non-Translated Strings
Our new QueryLocalizedStringNonTranslated event allows you to focus on strings that require translation in your application/website. Handle this event to find and log non-translated strings:
static Dictionary<string, string> deNotTranslatedResources = new Dictionary<string, string>();
private static void XtraLocalizer_QueryLocalizedStringNonTranslated(object sender, XtraLocalizer.QueryLocalizedStringEventArgs e) {
deNotTranslatedResources.Add(e.ResourceStringID, e.InvariantString);
}
This technique may be useful if you send localization strings to a different department or third-party translation service for translation.
RESX File Support
Our localization mechanism now supports RESX files. You can use a custom RESX file with translated strings. Use the UserResourceManager property as follows:
XtraLocalizer.UserResourceManager = Localization.myResources.ResourceManager;
Localize Built-In Data Forms
You can now localize resource strings used by Data Forms integrated in DevExpress UI controls (for example, the BookmarkForm in the WinForms Rich Text Editor). In previous versions, it was difficult to identify resource strings specific to built-in forms.
The QueryLocalizedStringContainerResource event fires when a data form requests a resource string for its UI element. Handle the event to translate non-localized resource strings or modify existing form element resources.
Event-Based Localization
The QueryLocalizedString event allows you to localize resources for all DevExpress UI controls in your application/website. The event fires when the DevExpress UI control requests a resource string and allows you to translate or modify the string as needed. We added new event parameters such as e.IsTranslated
, e.Value
, e.StringIDType
, etc.
static private void XtraLocalizer_QueryLocalizedString(object sender, XtraLocalizer.QueryLocalizedStringEventArgs e) {
if (e.StringIDType == typeof(GridStringId)) {
if ((GridStringId)e.StringID == GridStringId.GridGroupPanelText)
e.Value = "Gruppenregion";
}
//...
}
Summary
The DevExpress UI Localization Client helps you isolate strings used in your application/website. This makes it easy to identify non-translated resource strings, translate them as needed, and build RESX files (and include them in your project).
The following APIs allow you to implement advanced localization-related tasks:
- XtraLocalizer.QueryLocalizedStringNonTranslated
- XtraLocalizer.QueryLocalizedStringContainerResource
- XtraLocalizer.UserResourceManager
Documentation
Please read the documentation for step-by-step instructions, limitations, and troubleshooting: DevExpress UI Localization Client Documentation.
Your Feedback Matters
Please take a moment to answer the following questions. Your feedback will help us fine-tune development plans in our current release cycle.