Localization in WPF DateTimePicker (DateTimeEdit)
13 Sep 20231 minute to read
Localization is the process of translating the application resources into different language for the specific cultures. You can localize the DateTimeEdit by adding resource file. Application culture can be changed by setting CurrentUICulture after InitializeComponent
method.
Below application culture changed to French.
public MainWindow()
{
InitializeComponent();
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-FR");
}
To localize the DateTimeEdit based on CurrentUICulture using resource files, follow the below steps.
Step 1: Create new folder and named as Resources in your application.
Step 2: Right-click on the Resources folder, select Add and then NewItem.
Step 3: In Add New Item
wizard, select the Resource File option and name the filename as Syncfusion.Shared.Wpf.<culture name>.resx. For example, you have to give name as Syncfusion.Shared.WPF.fr-FR.resx for French culture.
Step 4: Now, select Add
option to add the resource file in Resources folder.
Step 5: Add the Name/Value pair in Resource Designer of Syncfusion.Shared.Wpf.fr-FR.resx file and change its corresponding value to corresponding culture.
The following screenshot shows the localized DateTimeEdit control.
NOTE
View Sample in GitHub