Localization in Xamairn.Android Schedule
9 Aug 20221 minute to read
Schedule control is available with complete localization support. Localization can be specified by setting the Locale property of SfSchedule. In the format of
Change default control language
Based on the
Locale specified the strings in the control such as Date, time, days are localized accordingly.
By default, schedule control is available with en locale, which is English.
//creating new instance for schedule SfSchedule schedule = new SfSchedule(this); //setting schedule view schedule.ScheduleView = ScheduleView.WeekView; //setting locale for the control schedule.Locale = new Locale("ja");
Change custom texts in the control.
You can localize the custom strings used in the schedule control. You can localize custom text available in the control by adding equivalent localized string in the string.xml file.
<resources> <string name="No_Appointments">Aucun événement</string> <string name="all_day">Toute la journée</string> </resources>
Android can select and load resources from different directories, based on the device configuration and locale, refer here. For an example, if an application requires multiple languages you can follow the below steps.
The procedure for creating strings.xml files is as follows:
- Translate the strings.xml file to each language.
- Create new folders under resource as values-
fr(The original values folder already exists).
- Place the translated strings.xml files in the respective folders.
You can download the entire source code of this demo for Xamarin.Android from
The corresponding values folder loads only depends on the device configuration and locale.