Localization
To localize RadTimeSpanPicker to display any text and messages in a specific language:
All required classes for localization are defined in Telerik.WinControls.UI.Localization namespace.
Start by creating a descendant of the RadTimeSpanPickerLocalizationProvider class.
Override the GetLocalizedString(string id) method and provide a translation for the label and user messages. If a translation is not provided, the default value will be returned. This behavior is guaranteed by the call to the base GetLocalizedString method in the default clause of the switch statement in the example.
Below is a sample implementation of an English localization provider:
class MyRadTimeSpanPickerLocalizationProvider : RadTimeSpanPickerLocalizationProvider
{
public override string GetLocalizedString(string id)
{
switch (id)
{
case RadTimeSpanPickerStringId.NullText: return "Select time span";
case RadTimeSpanPickerStringId.DaysText: return "Days";
case RadTimeSpanPickerStringId.HoursText: return "Hours";
case RadTimeSpanPickerStringId.MinutesText: return "Minutes";
case RadTimeSpanPickerStringId.SecondsText: return "Seconds";
case RadTimeSpanPickerStringId.MillisecondsText: return "Milliseconds";
case RadTimeSpanPickerStringId.CloseButtonText: return "Close";
}
return base.GetLocalizedString(id);
}
}
Friend Class MyRadTimeSpanPickerLocalizationProvider
Inherits RadTimeSpanPickerLocalizationProvider
Public Overrides Function GetLocalizedString(ByVal id As String) As String
Select Case id
Case RadTimeSpanPickerStringId.NullText
Return "Select time span"
Case RadTimeSpanPickerStringId.DaysText
Return "Days"
Case RadTimeSpanPickerStringId.HoursText
Return "Hours"
Case RadTimeSpanPickerStringId.MinutesText
Return "Minutes"
Case RadTimeSpanPickerStringId.SecondsText
Return "Seconds"
Case RadTimeSpanPickerStringId.MillisecondsText
Return "Milliseconds"
Case RadTimeSpanPickerStringId.CloseButtonText
Return "Close"
End Select
Return MyBase.GetLocalizedString(id)
End Function
End Class
To apply the custom localization provider, instantiate and assign it to the current localization provider:
Assigning the Current Localization Provider
RadTimeSpanPickerLocalizationProvider.CurrentProvider = new MyRadTimeSpanPickerLocalizationProvider();
RadTimeSpanPickerLocalizationProvider.CurrentProvider = New MyRadTimeSpanPickerLocalizationProvider()