Download source code
I recently published a blog post series on the Silvelight Show site regarding Internationalization/Globalization in Silverlight. As a follow up to this series, I would like to address a couple of Telerik-specific approaches to this topic. One thing to note is that the source code that I have attached above is written in Silverlight 4, using VisualStudio 2010 Beta 2, so if you are developing with Silverlight 3 you could copy the code into a Silverlight 3 solution.
In part 5 of the Silverlight Show series I provided a step-by-step example of how to set up an internationalized version of a Silverlight application using an MVVM approach. A good starting point would be to follow these steps, and then continue on with the steps provided below. Another approach would be to simply examine the attached source code, which does not utilize the MVVM pattern.
Please note that the RadControls for Silverlight Courseware also provides some valuable step-by-step information in its Localization chapter.
Assuming that you have followed the steps I outlined in part 5 of my Silverlight Show series, you can continue on with the following steps:
1. You will need to add a reference to the Telerik.Windows.Controls.dll. It is included in the source code for this blog series (Libs directory), or you could download a trial version from our web site.
2. Now, in App.xaml.cs replace the code in your Application_Startup method with the following:
private void Application_Startup(object sender, StartupEventArgs e)
// Set the culture, for testing purposes
//var culture = new CultureInfo("de-DE");
//Thread.CurrentThread.CurrentCulture = culture;
//Thread.CurrentThread.CurrentUICulture = culture;
LocalizationManager.DefaultResourceManager = Assets.Resources.MyStrings.ResourceManager;
LocalizationManager.DefaultCulture = new CultureInfo("de-DE");
this.RootVisual = new MainPage();
3. You will also need to add the following using statement at the top:
Notice how I have simply used Telerik’s LocalizationManager to set the culture (this code is for testing purposes only).
4. Now add the following namespace declaration at the top of MyView.xaml:
5. And replace the Grid with the following:
6. Now hit Ctrl+F5 and you should see the same result as you did at the end of the last post:
Now we will add one of Telerik’s RadControls to the page, the RadScheduler.
7. First you will need to add references to the Telerik.Windows.Controls.Input.dll and Telerik.Windows.Controls.Scheduler.dll (the RadScheduler depends on the RadDatePicker, which resides in the Input dll, so it is important that you include both).
These dll’s are included in the source code for this blog series (Libs directory), or you could download a trial version from our web site.
8. Now in MyView.xaml, add the following using statement near the top:
9. Next, replace the Grid with the following:
<Grid x:Name="LayoutRoot" Background="White">
<telerikScheduler:RadScheduler Width="500" Height="500" HorizontalAlignment="Left"/>
10. Hit Ctrl+5, and you should see the following:
Notice that the month names now display in German, and that we did not have to do anything to get this to work. All we did was drop the control on the page.
One of the great things about the RadControls is that they are already set up to support internationalization out of the box!
Copyright © 2016, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.