- Setting CurrentUICulture to the application
- Localize application level
Contact Support
Localization in .NET MAUI Calendar (SfCalendar)
By default, the calendar control supports US English localizations. You can change to other languages by adding the Globalization
namespace to your application.
Setting CurrentUICulture to the application
The application culture can be changed by setting CurrentUICulture
. in the App.xaml.cs
file.
using System.Resources;
using Syncfusion.Maui.Calendar;
using System.Globalization;
public partial class App : Application
{
public App()
{
InitializeComponent();
//// ResXPath => Full path of the resx file;
//// For example : SfPickerResources.ResourceManager = new ResourceManager("MauiTestCalendarLocalization.Resources.SfCalendar", Application.Current.GetType().Assembly);
CultureInfo.CurrentUICulture = CultureInfo.CreateSpecificCulture("ja-JP");
SfCalendarResources.ResourceManager = new ResourceManager("ResxPath", Application.Current.GetType().Assembly);
MainPage = new AppShell();
}
}
NOTE
The required
resx
files withBuild Action
asEmbeddedResource
(File name should contain culture code) into theResources
folder.
Localize application level
To localize the Calendar
based on CurrentUICulture
using resource
files, follow the below steps.
-
Create new folder, named as
Resources
in the application. -
Right-click on the
Resources
folder, selectAdd
and thenNewItem.
-
In Add New Item wizard, select the Resource File option and name the filename as
SfCalendar.<culture name>.resx.
For example, give the name asSfCalendar.ja-JP.resx
for French culture. -
The culture name indicates the name of the language and country.
-
Now, select
Add
option to add the resource file in Resources folder. -
Add the Name/Value pair in Resource Designer of
SfCalendar.ja-JP.resx
file and change its corresponding value to corresponding culture.