Localization in .NET MAUI DataGrid (SfDataGrid)
14 Oct 20252 minutes to read
Localization is the process of translating the application resources into different language for the specific cultures. The SfDataGrid can be localized by adding resource file. In SfDataGrid, provides the support to localize the below strings
Load MoreClick here to add new rowEqualsDoes Not EqualGreater ThanGreater Than or EqualLess ThanLess Than or EqualBegins WithDoes Not Begin WithEnds WithDoes Not End WithContainsDoes Not ContainBeforeBefore or EqualAfterAfter or EqualEmptyNot EmptyNullNot Null(Blanks)(Select All)OkCancel
Setting CurrentUICulture to the application
Application culture can be changed by setting CurrentUICulture. in App.xaml.cs file.
using Syncfusion.Maui.DataGrid;
using System.Globalization;
using System.Resources;
namespace MauiDataGridDemo;
public partial class App : Application
{
public App()
{
InitializeComponent();
CultureInfo.CurrentUICulture = new CultureInfo("fr-FR");
SfDataGridResources.ResourceManager = new ResourceManager("MauiDataGridDemo.Resources.SfDataGrid", Application.Current.GetType().Assembly);
MainPage = new MainPage();
}
}
NOTE
The required
resxfiles withBuild ActionasEmbeddedResource(File name should contain culture code) into theResourcesfolder.
Localize application level
To localize the DataGrid based on CurrentUICulture using resource files, follow the below steps.
-
Create new folder, named as
Resourcesin the application. -
Right-click on the
Resourcesfolder, selectAddand thenNewItem. -
In Add New Item wizard, select the Resource File option and name the filename as
SfDataGrid.<culture name>.resx.For example, give the name asSfDataGrid.fr-FR.resxfor French culture. -
The culture name indicates the name of the language and country.

- Now, select
Addoption to add the resource file in Resources folder.

- Add the Name/Value pair in Resource Designer of
SfDataGrid.fr-FR.resxfile and change its corresponding value to corresponding culture.
