Localize Standard XAF Modules and DevExpress Controls Used in an Application
4 min to read
The standard XAF modules and DevExpress controls supply most of the English texts an XAF application's interface uses. The DevExpress .NET Localization Service provides the ready-to-use translations of these texts into different languages - ASP.NET resources (required for an ASP.NET application) and satellite assemblies (required for WinForms, ASP.NET, and Mobile platforms). This topic describes how to use these translations in your application and how to manually localize standard XAF Modules and DevExpress controls when there are no ready-to-use translations for your language.
Satellite Assemblies for DevExpress Controls and XAF Modules
You can install pre-built satellite assemblies in the Global Assembly Cache (GAC) to avoid translating texts supplied with DevExpress controls and XAF Modules. Satellite assemblies for de, es, ja and ru languages are installed in %PROGRAMFILES(x86)%\DevExpress 19.2\Components\%PROGRAMFILES(x86)%\DevExpress 19.2\.NET Core Desktop Libraries\Bin folder and GAC. You can download satellite assemblies for other cultures from the DevExpress Localization Service. Refer to the How to register an assembly in the GAC KB article for more information on how to manually register satellite assemblies in the GAC.
You should deploy satellite assemblies with an XAF application. Refer to the corresponding Deployment Tutorial's topic for more information.
Localization Using the Localization Service
The Localization Service allows you to download and modify satellite assemblies. Set the .NET Platform to XAF to translate only XAF-specific values. Follow the steps from the Localization Service topic to localize XAF Modules. Note the following restrictions:
This service does not allow modifying default language text values.
Because the XAF Application Model has a tree-like structure, the Name column displays property names in a different format that contains a path to the property and property name. For example, the Application | Views | Person_DetailView node's Tooltip property has the "Application\Views\Person_DetailView\Tooltip" name in this table.
Calculated values are translated automatically based on the non-calculated values' translation. Input "non-calculated" in the search panel to show only the non-calculated values.
An item is only translated if it has a text value; otherwise, you can add a value for the target language or leave it blank.
Values containing properties' names (ObjectCaptionFormat, DisplayFormat, etc.) should not be localized. ObjectFormatter processes these values and replace properties' names with the corresponding values.
If you received the FormatException or MemberNotFoundException, ensure that you have not replaced a property name with a localized value.
In the Properties window, click the XafApplication.ResourcesExportedToModel property's ellipsis button. In the invoked dialog, check the resources you want to localize. Click OK to submit the selection.
Invoke the Model Editor for the current application project and localize the Localization node's child nodes.
You can also use the module's ModuleBase.ResourcesExportedToModel property to add localizable resources in the Module Designer. The resources added in a module cannot be removed from the localizable resources list in another module or application. For example, if you added the resources in the base Module, these resources are used in a platform-specific Modules, but you cannot delete these resources from the platform-specific Module.
Certain components added to a Model require a reference. For instance, after adding the XtraGrid Control to the Model, you get the following error: "The type 'DevExpress.XtraGrid.Localization.GridResLocalizer' is defined in an assembly that is not referenced. You should add a reference to assembly 'DevExpress.XtraGrid.v19.2...". Add a reference to the required assembly to resolve this issue.
Reuse Your Translations
You can use one of the following approaches to reuse translations in different XAF applications:
Localize all standard XAF module captions using the Model Editor invoked for the application project and share the resulting XAFML files with translations;
Create a new XAF module and localize all standard XAF module captions using the Model Editor invoked for its Model.DesignedDiffs.xafml file as described in the How to: Localize XAF Application Items Using XAF Tools topic. You can now use the Module or Application Designers to reuse this module in other applications.