Localization in .NET MAUI Time Picker (SfTimePicker)
21 Jul 20262 minutes to read
Localization is the process of translating the application resources into different languages for specific cultures. The SfTimePicker can be localized by adding resource files. SfTimePicker provides support to localize the following strings:
HourMinuteSecondMeridiemOKCancel
Setting CurrentUICulture to the application
The application culture can be changed by setting CurrentUICulture in the App.xaml.cs file.
using Syncfusion.Maui.Core;
using Syncfusion.Maui.Picker;
using System.Globalization;
using System.Resources;
namespace TimePicker;
public partial class App : Application
{
public App()
{
InitializeComponent();
CultureInfo.CurrentUICulture = new CultureInfo("fr-FR");
//// ResXPath => Full path of the resx file; For example : //SfPickerResources.ResourceManager = new ResourceManager
// ("TimePicker.Resources.SfTimePicker", Application.Current.GetType().Assembly);
SfPickerResources.ResourceManager = new ResourceManager("ResxPath", Application.Current.GetType().Assembly);
MainPage = new MainPage();
}
}
NOTE
The required
resxfiles must have theirBuild Actionset toEmbeddedResource, and the file name must contain the culture code. Place the files in theResourcesfolder.
Localize application level
To localize the SfTimePicker based on CurrentUICulture using resource files, follow the steps below.
-
Create a new folder named
Resourcesin the application. -
Right-click on the
Resourcesfolder, selectAdd, and then chooseNew Item. -
In the
Add New Itemwizard, select theResource Fileoption and name the fileSfTimePicker.<culture name>.resx. For example, useSfTimePicker.fr-FR.resxfor French culture. -
The culture name indicates the language and country.

-
Select
Addto add the resource file to theResourcesfolder.
-
Add a Name/Value pair in the Resource Designer of
SfTimePicker.fr-FR.resxand change the value to the corresponding culture.
