Edit this page

Localization

The built-in localization mechanism in Silverlight and WPF allows you to localize any string resource used by the standard RadScheduleView control. Once translated you might use your resources in Silverlight and WPF projects without changing anything.

RadScheduleView Localization 01

Supported Languages

RadScheduleView can be translated in one of the following supported languages using the framework’s localization mechanism:

  • English
  • German
  • Spanish
  • French
  • Italian
  • Dutch
  • Turkish

More information on how to achieve this you can find in the Localization Using Built-in Resources article.

LocalizationManager

The Telerik.Windows.Controls.LocalizationManager allows you to easily localize any of the Telerik controls.

To apply custom localization to your controls just instantiate your custom LocalizationManager and set it to the static property LocalizationManager.Manager, before the creation of the UI.

C#

LocalizationManager.Manager = new CustomLocalizationManager();

VB.NET

LocalizationManager.Manager = New CustomLocalizationManager()

Note that you have to set the localization manager before the creation of the UI, otherwise some parts might remain not-localized.

Resource Keys

RadScheduleView is a complex user interface control and its strings for localization are numerous. In order to be able to distinguish these resources, a unique identifier, called resource key, is assigned to each localizable string.

On the picture below you can see some of the resource keys and the strings they are associated with. A complete list of the RadScheduleView resource keys can be found here.

RadScheduleView Localization 01

Localization Using ResourceManager

You can base your localization on the standard resource files provided by the .NET framework. For that purpose you will have to create a separate .ResX file for each one of the languages that your application will support.

Imagine that you want to translate your schedule control into English, German and Dutch. For that purpose you will have to add three new resource files to your project:

  • ScheduleViewResources.resx - this resource file will store the English(default) resources for the ScheduleView control. Set the AccessModifier property to Public.

  • ScheduleViewResources.de.resx - this resource file will store the German resources for the ScheduleView control. Set the AccessModifier property to No code generation.

  • ScheduleViewResources.nl.resx - this resource file will store the Dutch resources for the ScheduleView control. Set the AccessModifier property to No code generation.

RadScheduleView Localization04

Now, having the needed files, it's time to illustrate the idea and localize for example the text for the Day, Week, Month and Timeline navigation strings. For that purpose you need to create four resource strings in each one of the three resource files and translate them to the appropriate language.

Note that the name of the resource string should be the same as the resource key for the string you are localizing i.e. the resource key for the Day is Day, for the Week is Week, for Month is Month and for the Timeline is Timeline.

The snapshot below shows the content of the ScheduleViewResources.de.resx file. The resource name of the other two files should be the same. The Value column will contain the translation for the appropriate language.

RadScheduleView Localization3

The last step is to instantiate the LocalizationManager class and set its ResourceManager to the resources that have been just created.

C#

LocalizationManager.Manager = new LocalizationManager()
{
   ResourceManager = ScheduleViewResources.ResourceManager
};

VB.NET

LocalizationManager.Manager = New LocalizationManager()
LocalizationManager.Manager.ResourceManager = ScheduleViewResources.ResourceManager

If you rely on culture settings to load the right resources automatically, you have to write some code inside your application's project file. For example, >if you have to support English and Dutch languages, you can store the localized strings in Resources.resx and Resources.nl.resx files. For the >Resources.resx file you can set ResXFileCodeGenerator to Internal or Public and for others - to No code generation. Then, open the project >file in a text-mode and insert the code below into the section. In this way you notify the framework about the supported cultures.
en;nl

Here is how the localized RadScheduleView looks like:

RadScheduleView Localization 06

Localization Using Custom Localization Manager

The other way to localize your RadScheduleView control is to create a class that derives from the LocalizationManager object and to override its method GetStringOverride(). The logic is pretty simple, you just have to create a switch statement and return the correct translation for each resource key, as it is shown below:

C#

public class CustomLocalizationManager : LocalizationManager
{
   public override string GetStringOverride( string key )
   {
       switch( key )
       {
           case "Timeline":
               return "Zeitline";
           case "Day":
               return "Tag";
           case "Week":
               return "Woche";
           case "Month":
               return "Monat";
           case "SaveAndCloseCommandText":
               return "Speichern & Sliessen";
           case "EditRecurrence":
               return "Serie bearbeithen";
           case "Categories":
               return "Kategrisieren";
       }
       return base.GetStringOverride( key );
   }
}

VB.NET

Public Class CustomLocalizationManager
    Inherits LocalizationManager
    Public Overloads Overrides Function GetStringOverride(ByVal key As String) As String
        Select Case key
            Case "Timeline"
                Return "Zeitline"
            Case "Day"
                Return "Tag"
            Case "Week"
                Return "Woche"
            Case "Month"
                Return "Monat"
            Case "SaveAndCloseCommandText"
                Return "Speichern & Sliessen"
            Case "EditRecurrence"
                Return "Serie bearbeithen"
            Case "Categories"
                Return "Kategrisieren"
        End Select
        Return MyBase.GetStringOverride(key)
    End Function
End Class

Of course, if you don't want to hard-code your translation inside your source code, you can always use resource files:

C#

public override string GetStringOverride( string key )
{
   switch( key )
   {
       //----------------------
       case "Timeline":
           return ScheduleViewResources.Timeline;
       //----------------------
   }
   return base.GetStringOverride( key );
}

VB.NET

Public Overloads Overrides Function GetStringOverride(ByVal key As String) As String
    Select Case key
        '----------------------
        Case "Timeline"
            Return ScheduleViewResources.Timeline
        '----------------------
    End Select
    Return MyBase.GetStringOverride(key)
End Function

RadScheduleView Resource Keys

The following Resource Keys are available:

  • AllDayEvent

  • Appointment

  • AppointmentRecurrence

  • AppointmentTime

  • Body

  • Busy

  • Cancel

  • Categorize

  • CreateAppointment

  • Daily

  • Day

  • Days

  • DeleteAppointment

  • DeleteItem

  • DeleteItemQuestion

  • DeleteOccurrence

  • DeleteRecurringItem

  • DeleteRecurringItemQuestion

  • DeleteSeries

  • DurationColon

  • DurationDay

  • DurationDays

  • DurationHour

  • DurationHours

  • DurationMinute

  • DurationMinutes

  • DurationWeek

  • DurationWeeks

  • EditAppointment

  • EditParentAppointment

  • EditRecurrence

  • EditRecurrenceCommandText

  • EditRecurrenceRule

  • EndAfter

  • EndBy

  • EndColon

  • EndDateBeforeStart

  • EndTime

  • Event

  • Every

  • EveryDay

  • EveryWeekday

  • First

  • Fourth

  • Free

  • HighImportance

  • InvalidRecurrenceRuleMessage

  • InvalidRecurrenceRuleTitle

  • Last

  • LowImportance

  • Month

  • Monthly

  • Months

  • NoEndDate

  • Occurrences

  • Of

  • OfEvery

  • Ok

  • OpenOccurrence

  • OpenRecurringItem

  • OpenRecurringItemQuestion

  • OpenSeries

  • OutOfOffice

  • RangeOfRecurrence

  • RecurEvery

  • RecurrencePattern

  • RemoveRecurrence

  • SaveAndClose

  • SaveAndCloseCommandText

  • SaveAppointment

  • SaveRecurrence

  • Second

  • SetDayViewMode

  • SetMonthViewMode

  • SetTimelineViewMode

  • SetWeekViewMode

  • ShowAs

  • Start

  • StartColon

  • StartTime

  • Subject

  • Tentative

  • The

  • Third

  • Timeline

  • Untitled

  • Week

  • WeekDays

  • WeekendDays

  • Weekly

  • WeeksOn

  • Yearly

  • DragRecurringWarning

Using Built-In Resources

RadScheduleView provides you with built-in resources for several cultures: Spanish, German, Italian, Turkish, Dutch.

To change the default culture, you should set the CurrentCulture and the CurrentUICulture of the CurrentThread. Note that this must happen in the code-behind of your Application (App.xaml.cs) file, right before the UI initialization. The next code-snippet shows you how to change the CurrentCulture to Dutch.

C#

public partial class App : Application
{
   public App()
   {
       System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo( "nl" );
       System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo( "nl" );
       this.Startup += this.Application_Startup;
       this.Exit += this.Application_Exit;
       this.UnhandledException += this.Application_UnhandledException;
       InitializeComponent();
   }
}