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
.
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.
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.
You can get the SfTreeGrid’ s key from default resource Syncfusion.SfGrid.UWP.Resources.resw.
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.
Now, change the Name/Value pair in Resource Designer of Syncfusion.SfGrid.UWP.Resources.resw
file.