Localization in UWP TreeGrid (SfTreeGrid)

10 May 20211 minute to read

Localization is the process of translating the application resources into different language for the specific cultures. You can localize the treegrid by adding resource file. Application culture can be changed by setting CurrentUICulture before InitializeComponent method.

Below application culture changed to German.

public MainPage()
{
    System.Globalization.CultureInfo.CurrentUICulture = new System.Globalization.CultureInfo("de");
    this.InitializeComponent();
}

Localize the drag and drop window text in treegrid

To localize the treegrid, drag and drop window based on CurrentUICulture using resource files, follow the below steps.

1.Right-click on the project, select Add and then NewItem.

2.In Add New Item wizard, select the Resource File option and name the filename as Syncfusion.SfGrid.UWP.Resources.<culture name>.resw.

Creating resource file

3.For example, you have to give name as Syncfusion.SfGrid.UWP.Resources.de.resw for German culture.

4.The culture name that indicates the name of language and country.

5.Now the resource file is added.

Added the created resource file

6.Add the Name/Value pair in Resource Designer of Syncfusion.SfGrid.UWP.Resources.de.resw file and change its corresponding value to corresponding culture.
Providing the resources as per culture

You can get the SfTreeGrid’ s key from default resource Syncfusion.SfGrid.UWP.Resources.resw.

Drag drop window of UWP treegrid with localized string

You can download the sample here.

Edit default culture resource

You can edit default resource file by adding it to your application where the treegrid reads the static texts from here. You can download the default resource file from here.

Default resource file

Now, change the Name/Value pair in Resource Designer of Syncfusion.SfGrid.UWP.Resources.resw file.

Modifying the default localization in resource

Drag and drop window of UWP treegrid with modified resource