New to Telerik UI for Xamarin? Download free 30-day trial

Date and Time Picker Localization

RadDateTime Picker for Xamarin provides language localization. In short, you can translate the used across the Date and Time Picker texts to other languages, so that your app can be adapted to different regions.

To learn in details about the localization process of Telerik UI for Xamarin components, please go through the common Localization and Globalization topic.

The sections below list all the localization keys used in Date and Time Picker Spinners.

Date and Time Spinners Localization Keys

Localization Key Default Value
DateTimePicker_Popup_HeaderLabelText Select Date and Time
DateTimePicker_PlaceholderLabelText Select Date and Time

Common Picker Localizations strings

Localization Key Default Value
Picker_AmPmSpinnerHeaderLabelText AM/PM
Picker_DaySpinnerHeaderLabelText Day
Picker_HourSpinnerHeaderLabelText Hours
Picker_MinuteSpinnerHeaderLabelText Minutes
Picker_SecondSpinnerHeaderLabelText Seconds
Picker_MonthSpinnerHeaderLabelText Month
Picker_YearSpinnerHeaderLabelText Year
Picker_Popup_AcceptButtonText OK
Picker_Popup_CancelButtonText Cancel

Check in the image below how the localization strings are presented in Date and Time Picker:

DateTime Picker Localization

Example with CustomLocalizationManager

The snippet below shows a simple RadDateTimePicker definition:

<telerikInput:RadDateTimePicker>
    <telerikInput:RadDateTimePicker.SelectorSettings>
        <telerikInput:PickerPopupSelectorSettings IsHeaderVisible="True"/>
    </telerikInput:RadDateTimePicker.SelectorSettings>
</telerikInput:RadDateTimePicker>

In addition to this, you need to add the following namespace:

xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"

Create a custom class that inherits from TelerikLocalizationManager and override the GetString() method:

TelerikLocalizationManager.Manager = new CustomDateTimePickerLocalizationManager();

Set it as the TelerikLocalizationManager.Manager:

public class CustomDateTimePickerLocalizationManager : TelerikLocalizationManager
{
    public override string GetString(string key)
    {

        if (key == "DateTimePicker_Popup_HeaderLabelText")
            return "Datum und Uhrzeit Picker";
        if (key == "DateTimePicker_PlaceholderLabelText")
            return "Datum und Uhrzeit auswählen";
        if (key == "Picker_AmPmSpinnerHeaderLabelText")
            return "am/pm";
        if (key == "Picker_DaySpinnerHeaderLabelText")
            return "Tag";
        if (key == "Picker_HourSpinnerHeaderLabelText")
            return "Zeit";
        if (key == "Picker_MinuteSpinnerHeaderLabelText")
            return "Minute";
        if (key == "Picker_SecondSpinnerHeaderLabelText")
            return "Sekunde";
        if (key == "Picker_MonthSpinnerHeaderLabelText    ")
            return "Monat";
        if (key == "Picker_YearSpinnerHeaderLabelText")
            return "Jahr";
        if (key == "Picker_Popup_AcceptButtonText")
            return "Akzeptieren";
        if (key == "Picker_Popup_CancelButtonText")
            return "Stornieren";

        return base.GetString(key);
    }
}

A sample Localization example can be found in the DateTimePicker/Features folder of the SDK Samples Browser application.

See Also

In this article
Not finding the help you need? Improve this article