Localization of Syncfusion WinUI controls

28 Apr 20212 minutes to read

Localization is the process of making an application multilingual by formatting the content according to the cultures. This involves configuring the application for a specific language.Culture is the combination of language and location. For example,
en-US is the culture for English spoken in United States; en-GB is the culture for English spoken in Great Britain. Syncfusion WinUI controls can be localized by adding resource file for each language.

Changing application culture

The application culture can be changed by assigning the CultureInfo.CurrentUICulture to the desired language in the constructor of the Main page.While changing the application culture, localization can be done by creating .resw file.

public sealed partial class MainPage
    {
        public MainPage()
        {
            CultureInfo.CurrentUICulture = new CultureInfo("de");
            this.InitializeComponent();
        }
    }

Creating .resw files

The .resw files for any language can be created by following the steps below:

NOTE

The default resource files of all Syncfusion WinUI libraries can be obtained from GitHub.

1) Right click the project and add New folder named as “Resources”.

2) Add another folder and name the folder with “Culture name”. For example, “de” for German culture. Find the supported culture codes from here

3) Add default resource files in the following structure.

WinUI DataGrid resw file

NOTE

If SfDataGrid control is used in the application, then copy and include Syncfusion.Grid.WinUI.resw (SfDataGrid present in Syncfusion.Grid.WinUI library) file in the application under Resources folder. So, now the key names and values of default strings used in Syncfusion.Grid.WinUI library are known.

4) Now, the key names from default resource files can be defined and assigned value based on the culture.

WinUI DataGrid Localization

Download demo from GitHub

Editing default culture strings

The default string of any control can be changed by adding the default .resw files (from GitHub) to Resources folder of the application. Syncfusion WinUI controls reads the default string from the .resw files of the application if its added.