Localization in UWP DataGrid (SfDataGrid)
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 SfDataGrid by adding [resource] (https://msdn.microsoft.com/library/aa992030.aspx) 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();
}
To localize the SfDataGrid based on CurrentUICulture using .resw files, follow the below steps.
-
Right-click on the project, select Add and then NewItem.
-
In Add New Item wizard, select the Resource File option and name the filename as Syncfusion.SfGrid.UWP.Resources.<culture name>.resw .
For example, you have to give name as Syncfusion.SfGrid.UWP.Resources.de.resw for German culture.
-
The culture name that indicates the name of language and country.
-
Now the resource file is added.
5.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 SfDataGrid’s key from default resource Syncfusion.SfGrid.UWP.Resources.resw.
Editing default culture resource
You can edit default resource file by adding it to your application where SfDataGrid 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.