Localization
To localize RadTimePicker to display control 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 RadTimePickerLocalizationProvider 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:
Localizing RadTimePicker Strings
class MyTimePickerLocalizationProvider : RadTimePickerLocalizationProvider
{
public override string GetLocalizedString(string id)
{
switch (id)
{
case RadTimePickerStringId.HourHeaderText: return "Hours";
case RadTimePickerStringId.MinutesHeaderText: return "Minutes";
case RadTimePickerStringId.CloseButtonText: return "Close";
default: return string.Empty;
}
}
}
Class MyTimePickerLocalizationProvider
Inherits RadTimePickerLocalizationProvider
Public Overrides Function GetLocalizedString(id As String) As String
Select Case id
Case RadTimePickerStringId.HourHeaderText
Return "Hours"
Case RadTimePickerStringId.MinutesHeaderText
Return "Minutes"
Case RadTimePickerStringId.CloseButtonText
Return "Close"
Case Else
Return String.Empty
End Select
End Function
End Class
To apply the custom localization provider, instantiate and assign it to the current localization provider:
Assigning the Current Localization Provider
RadTimePickerLocalizationProvider.CurrentProvider = new MyTimePickerLocalizationProvider();
RadTimePickerLocalizationProvider.CurrentProvider = New MyTimePickerLocalizationProvider()
The code provided above illustrates the approach to be used to localize the RadTimePicker and is not intended as a full translation.