Tuesday, 7 December 2010

Localize Telerik RadReminder

Like most of the offerings from the Telerik WinForms suite, it is possible to localize the RadReminder. However, this does not seem to be documented at the moment on the Telerik website.

localizing the RadReminder is easy and just like localizing all the other RadControls.

  • Start by creating a descendant of the RadReminderLocalizationProvider class.
  • Override the GetLocalizedString(string id) method and provide a translation for the 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
Public Class MyRadReminderLocalizationProvider
    Inherits Telerik.WinControls.UI.RadReminderLocalizationProvider

    Public Overrides Function GetLocalizedString(ByVal id As String) As String
        Select Case id
            Case RadReminderStringId.AlarmFormButtonDismiss
                Return "Dismiss"
            Case RadReminderStringId.AlarmFormButtonDismissAll
                Return "Dismiss All"
            Case RadReminderStringId.AlarmFormButtonOpenItem
                Return "Open Item"
            Case RadReminderStringId.AlarmFormButtonSnooze
                Return "Snooze"
            Case RadReminderStringId.AlarmFormColumnDueIn
                Return "Due in"
            Case RadReminderStringId.AlarmFormColumnSubject
                Return "Subject"
            Case RadReminderStringId.AlarmFormLabelSnooze
                Return "Click Snooze to be reminded again in:"
            Case RadReminderStringId.AlarmFormReminder
                Return "Reminder"
            Case RadReminderStringId.AlarmFormReminders
                Return "Reminders"
            Case RadReminderStringId.AlarmFormSnoozeEightHours
                Return "8 hours"
            Case RadReminderStringId.AlarmFormSnoozeFifteenMinutes
                Return "15 minutes"
            Case RadReminderStringId.AlarmFormSnoozeFiveMinutes
                Return "5 minutes"
            Case RadReminderStringId.AlarmFormSnoozeFourDays
                Return "4 days"
            Case RadReminderStringId.AlarmFormSnoozeFourHours
                Return "4 hours"
            Case RadReminderStringId.AlarmFormSnoozeHalfDay
                Return "0.5 days"
            Case RadReminderStringId.AlarmFormSnoozeOneDay
                Return "1 day"
            Case RadReminderStringId.AlarmFormSnoozeOneHour
                Return "1 hour"
            Case RadReminderStringId.AlarmFormSnoozeOneMinute
                Return "1 minute"
            Case RadReminderStringId.AlarmFormSnoozeOneWeek
                Return "1 week"
            Case RadReminderStringId.AlarmFormSnoozeTenMinutes
                Return "10 minutes"
            Case RadReminderStringId.AlarmFormSnoozeThirtyMinutes
                Return "30 minutes"
            Case RadReminderStringId.AlarmFormSnoozeThreeDays
                Return "3 days"
            Case RadReminderStringId.AlarmFormSnoozeTwoDays
                Return "2 days"
            Case RadReminderStringId.AlarmFormSnoozeTwoHours
                Return "2 hours"
            Case RadReminderStringId.AlarmFormSnoozeTwoWeeks
                Return "2 weeks"
            Case RadReminderStringId.DueInDay
                Return "day"
            Case RadReminderStringId.DueInDays
                Return "days"
            Case RadReminderStringId.DueInHour
                Return "hour"
            Case RadReminderStringId.DueInHours
                Return "hours"
            Case RadReminderStringId.DueInMinute
                Return "minute"
            Case RadReminderStringId.DueInOverdue
                Return "overdue"
            Case RadReminderStringId.DueInWeek
                Return "week"
            Case RadReminderStringId.DueInWeeks
                Return "weeks"
        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:

RadReminderLocalizationProvider.CurrentProvider = New MyRadReminderLocalizationProvider()

No comments:

Post a Comment