Skip to main content
A newer version of this page is available. .
All docs
V20.2

How to: Localize an XAF .NET 5 Application (Blazor and WinForms)

  • 3 minutes to read

This topic describes how to localize XAF .NET 5 applications (WinForms and Blazor).

Tip

Refer to the How to: Localize an XAF Application topic for information on ho to localize XAF .NET Framework Applications.

Review the Application Model Basics and Localization Basics topics before proceeding.

  1. Choose the language you want to use in your XAF application.

    Pre-installed languages: German (de), Spanish (es), Japanese (ja) and Russian (ru). These assemblies are available in DevExpress Local NuGet Feed, for example, DevExpress.ExpressApp.de or DevExpress.ExpressApp.Core.All.de.

    Other languages:

    • Use the Localization Service to download satellite assemblies. See the Localize Standard XAF Modules and DevExpress Controls Used in an Application topic for more information on how to use this service to localize XAF modules.
    • Place the downloaded assemblies in the following folders:
      • in your application bin folder, for example \Solution1.BlazorServer\bin\Debug\net5.0\fr for French. This enable runtime localization.
      • in your Model Editor’s folder, for example C:\Program Files (x86)\DevExpress 20.2\Components\Tools\eXpressAppFrameworkNetCore\Model Editor\fr for French. This enable design-time localization.

    Satellite assemblies are reusable in any other project.

    Note

    Remember to deploy the required satellite assemblies when deploying an XAF application. Refer to the Deployment Tutorial for more details.

  2. For XAF Blazor applications. Add the ApplicationBuilderExtensions.UseRequestLocalization() method call. This enables the RequestLocalizationMiddleware.

     namespace MainDemo.Blazor.ServerSide { 
        public class Startup { 
            // ...
            public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { 
                // ...
                app.UseHttpsRedirection(); 
                // Enable the RequestLocalizationMiddleware 
                app.UseRequestLocalization(); 
                app.UseStaticFiles(); 
                app.UseRouting(); 
                // ...
            } 
        } 
    } 
    

    In appsettings.json, specify languages used in your application in the DevExpress:ExpressApp:Languages section. This languages list is used to:

    The first language in this list is used as the default language (specified in the RequestLocalizationOptions.SupportedCultures).

    { 
        // 
        "DevExpress": { 
            "ExpressApp": { 
                "Languages": "en;de;fr" 
                 // ...
            } 
        } 
    }  
    
  3. In the module project, double-click the Model.DesignedDiffs.xafml file to invoke the Model Editor. Focus the root node and click Languages Manager… in the Language combo box on the Model Editor Toolbar. Add the target language in the invoked dialog and click OK. Restart Visual Studio to load localized values from the satellite assemblies and specify the application’s target language in the Language combo box.

    Tutorial_UIC_Lesson11_0_1

    Refer to the Localization Basics topic for more information.

  4. To add a new or modify an existing translation value, use one of the tools described in the How to: Localize XAF Application Items Using XAF Tools topic.
  5. To specify an application’s language, invoke the Model Editor for an application project, navigate to the Application node, and set the IModelApplication.PreferredLanguage property to a language. Refer to the Localization Basics topic for more details. If you want your application’s language to match the language on the user’s device, set the PreferredLanguage property to (User language).
  6. Windows Forms Templates‘ localizable resources are not available in the Application Model by default. Refer to the How to: Localize a WinForms Template to learn how you can localize Windows Forms templates.
  7. The splash screen form displayed on the Windows Forms application startup contains a “Loading“ text label. You can specify a different text as described in the Localize a Splash Form topic.
  8. Start the application to ensure that all the text values are localized.