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

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. Satellite assemblies for de, es, ja and ru languages are installed in %PROGRAMFILES(x86)%\DevExpress 21.2\Components\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.

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.

    LocalizationService_NonCalculated

  • 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 FormatException or MemberNotFoundException, ensure that you have not replaced a property name with a localized value.
    • Strings from the DevExpress.Persistent.BaseImpl.EFCore assembly are not available in the Localization Service. To localize these strings, use the Localization Tool.

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.

    ResourceLocalizers

  • Invoke the Model Editor for the current application project and localize the Localization node’s child nodes.

    ResourceLocalizers_Model

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 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.v21.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.
See Also