Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Collapse]Build an Application
  [Expand]Choose Application UI
   Data Management Controls
  [Expand]Printing and Exporting
  [Expand]WinForms MVVM
  [Expand]Skins
  [Expand]Localization
  [Collapse]Right-to-Left Layout
    How to: Enable RTL Mode in a Right-to-Left Culture Application
    How to: Enable RTL Mode for Form's Controls, Strings and Images in a Multiple Culture Application
    How to: Enable RTL Mode for Non-form-based Interfaces in a Multiple Culture Application
   Redistribution and Deployment
 [Expand]Controls and Libraries
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Enable RTL Mode for Non-form-based Interfaces in a Multiple Culture Application

Your application may contain visual elements that display custom strings and images that are not stored in form resources (e.g., hard coded strings, message boxes, DXPopupMenu, etc.). The adaptation of these elements to Right-to-Left mode also involves a localization step.

To learn how to adapt a Form's UI to RTL mode in an application that supports several languages (including those that use a right-to-left writing system), see How to: Enable RTL Mode for Form's Controls, Strings and Images in a Multiple Culture Application.

Expanded Message Boxes

A typical element whose strings are not stored in form resources is a Message Box. Unlike the standard MessageBox, the XtraMessageBox automatically adapts (mirrors) its layout when RTL mode is detected (for the standard MessageBox a special flag needs to be enabled). So, the two things to do when creating a RTL-ready XtraMessageBox are:

  • Translate the message box's custom text and caption (as demonstrated in the walkthrough below).
  • Localize the text of the standard buttons (OK, Cancel, Yes, No, etc.). This task is common to all DevExpress controls that display certain built-in localizable resources and is covered in the Localization document.
In the following figure, you can see an XtraMessageBox displayed for the default culture.

The localized XtraMessageBox with RTL mode enabled.

Expanded DXPopupMenu

The DXPopupMenu automatically reverses the layout of its items in RTL mode. You only need to translate custom text to the target languages, as shown below.

The following walkthrough demonstrates how to localize custom text within XtraMessageBox. The text localization method shown is also applicable to text in DXPopupMenu, hard coded strings, etc.

Expanded Walkthrough: How to localize custom strings within an XtraMessageBox

While strings and images within forms and controls should be localized using form-based resources (see How to: Enable RTL Mode for Form's Controls, Strings and Images in a Multiple Culture Application), non-forms-based user interface strings and images, such as strings within message boxes, must be localized using project resources. To provide culture-specific text for message boxes using non-form-based resource files, follow the steps below.

  1. In the Visual Studio Menu Bar, invoke the Project menu, and click Add New Item. Using the Add New Item dialog, create a new Resource File. Name the file Messages.resx. This file is used for the default language.

  2. Populate the data table with the required string values for the default culture.

  3. Add another new Resource File for a localized application version. Name the file Messages.he.resx. The file name contains a suffix that specifies the culture to which the resource file corresponds.
    Note

    For a full list of available culture names, refer to the National Language Support (NLS) API Reference topic in MSDN.

  4. Open the created file using the Solution Explorer window, and populate the data table with the appropriate strings.
  5. To use localized strings when invoking an XtraMessageBox, see the following code.
  6. After these steps, if the application runs on an operating system that uses Hebrew, custom text in the message box is automatically translated.

  7. Localize built-in button captions as covered in the Localizing WinForms Controls via Satellite Resource Assemblies document. This approach helps you localize all built-in string resources of DevExpress controls.

    The approach described in this topic involves using the Localization Service to get satellite resource assemblies. When the assemblies are downloaded, locate a folder named according to the abbreviation of the required culture (e.g., he for the Hebrew culture) and simply copy it into the directory where the executable file of your application is located. No code needs to be written, since the application automatically determines the current culture, and loads the appropriate assemblies on startup. The figure below shows the entirely translated message box.

To test how controls and other visual elements (including XtraMessageBox) are translated to a certain culture, you can manually enable this culture on application startup.

Expanded See Also

How would you rate this topic?​​​​​​​