Localization in UWP DataGrid (SfDataGrid)

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.

  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 .

Shows the name of resource file to be added for UWP DataGrid

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

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

  2. Now the resource file is added.

Shows the added resource file for German language in UWP DataGrid

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.

Shows the added resource file name / value pair in the resource designer in UWP DataGrid

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

Shows the localized in German for UWP DataGrid

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.

Displaying the default culture resource editing for UWP SfDataGrid

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

Displaying the name / value pair in the resource designer for default culture resource in UWP SfDataGrid

Displaying UWP SfDataGrid with the default culture resource edited