Localize Standard XAF Modules and DevExpress Controls Used in an Application
- 5 minutes 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 Web Forms resources (required for an ASP.NET Web Forms application) and satellite assemblies (required for WinForms and ASP.NET Web Forms 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.
The .NET Product Installer includes assemblies for de, es, and ja languages. You can install them at your discretion. Use the DevExpress Localization Service to download satellite assemblies for other languages. Refer to the following topics for more information on how to register localization resources:
Add the new language aspect as described in the Localization Basics topic, and restart Visual Studio to display localized values in the Model Editor.
Ensure that the Languages key from the configuration file’s appSettings section contains all the languages your application supports:
<configuration>
<appSettings>
<!-- ... -->
<add key="Languages" value="en;de;fr" />
<!-- ... -->
</appSettings>
<!-- ... -->
<configuration>
For .NET Framework applications, you can handle the XafApplication.CustomizeLanguagesList event as an alternative to the configuration setting above.
Note
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.
- You can translate values for XPO classes from the Business Class Library only.
- 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.
- Check Show Calculated Values to show items that do not require translation: calculated values, items without a value in a default language, Domain Components from the Business Class Library, and values that contain property names (for example, ObjectCaptionFormat, DisplayFormat).
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 replaces properties’ names with the corresponding values.
Note
- If you received Format
Exception or MemberNot , ensure that you have not replaced a property name with a localized value.Found Exception - Strings from the DevExpress.
Persistent. assembly are not available in the Localization Service. To localize these strings, use the Localization Tool.Base Impl. EFCore
- If you received Format
#Manual Localization
If the technique described in the section above does not apply to you, follow the instructions from the following topic: How to: Localize XAF Application Items Using XAF Tools.
Culture-specific resources should be exported to the Application Model when you localize DevExpress Controls.
- Invoke the Application Designer.
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.
Note
Certain components added to a Model require a reference. For instance, after adding the Xtra
#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.