Localization in .NET MAUI Picker (SfPicker)
21 Jul 20262 minutes to read
Localization translates application resources for specific cultures. The SfPicker can be localized by adding a resource file.
Setting CurrentUICulture to the application
Set the application culture in App.xaml.cs by assigning CurrentUICulture.
using System.Resources;
using System.Globalization;
using Syncfusion.Maui.Picker;
namespace Picker;
public partial class App : Application
{
public App()
{
InitializeComponent();
//// ResXPath => Full path of the resx file; For example : // SfPickerResources.ResourceManager = new ResourceManager
("Picker.Resources.SfPicker", Application.Current.GetType().Assembly);
CultureInfo.CurrentUICulture = new CultureInfo("fr-FR");
SfPickerResources.ResourceManager = new ResourceManager("ResxPath", Application.Current.GetType().Assembly);
MainPage = new AppShell();
}
}
NOTE
The required
resxfiles withBuild ActionasEmbeddedResource(file name should contain the culture code) must be added to theResourcesfolder.
Localize at the application level
To localize the SfPicker based on CurrentUICulture using resource files, follow these steps.
-
Create a new folder named
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
SfPicker.<culture name>.resx.For example, give the name asSfPicker.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
SfPicker.fr-FR.resxfile and change its corresponding value to corresponding culture.
