Copied RSS Feed

Silverlight

Localization for Syncfusion Tools Silverlight Controls

Introduction

Localization is the process of providing controls in different cultures, allowing end-users to set their own culture. In the globalized world, you cannot just ship software with only one language; you have to be in a position to provide an application with localized culture support. In Essential Studio® Volume 3, Syncfusion Silverlight Tools controls ship with complete support for localization, which makes your life easier by being able to localize your entire application.

Here we will discuss how you can enable localized support for your application with Syncfusion controls.

Getting Started

Here are the primary things to do for localizing Syncfusion Silverlight controls in your application:

  1. Add resources for different cultures with localized content.
  2. Add the supported cultures.
  3. Assign the current UI culture to the application.

 

Step 1 – Add Resources

To localize Syncfusion Silverlight controls, you need to create resource files with the proper naming convention for each culture. The following steps need to be done when localizing strings for your culture.

  1. Add Resource (.resx) files in the Resources folder for different cultures. (Here, .resx files in different cultures or invariant cultures should be placed in the Resources folder of your project).
  2. Resource files should be named AssemblyName.CultureName.resx and AssemblyName.resx for invariant cultures.

In step two, AssemblyName is the Syncfusion Silverlight control assembly name and CultureName is the culture code of the resource you want to show in the UI. If your conversion is only for an invariant culture, the .resx file does not need to contain a culture suffix. 

For example …

  • Syncfusion.Tools.Silverlight.fr-FR.resx – Is the French resource for Syncfusion.Tools.Silverlight assembly.
  • Syncfusion.Tools.Silverlight.resx – Is an invariant culture resource for Syncfusion.Tools.Silverlight assembly.

     3. Apply the localized content in the Syncfusion.Tools.Silverlight.fr-FR.resx file for each string variable, as given below, for localizing the Ribbon Control Customization dialog and context menu.

Name

Value

Add

Ajouter

Cancel

Annuler

ChooseOtherCommandsFrom

Choisir les commandes d’autres:

CustomizeQuickAccessToolbar

Personnaliser la barre d’outils Accès rapide …

DefaultRibbonBarCaption

Ruban Bar

DefaultRibbonButtonCaption

Ruban Button

DefaultRibbonTabCaption

Ruban Tab

DefaultRibbonTitle

Ma demande

MinimizeRibbon

Réduire ruban

MoreCommands

Commandes en savoir plus …

OK

OK

QATPopupHeader

Personnaliser la barre d’outils Accès rapide

QATShowAbove

Voir la barre d’outils accès rapide au-dessus du ruban

QATShowBelow

Voir la barre d’outils accès rapide sous le ruban

Remove

Supprimer

Reset

Remise

Note: This table shows the necessary string variable names that are needed only for this post. You may need to apply many other string variables based on the control feature. Complete information will be published with the 2010 Volume 3 documentation.

Step 2 – Add Supported Cultures

It’s very important to add supported cultures in the sample application project before running the application.

  1. In the Solution Explorer, right-click your sample application project and choose Unload Project from the context menu. Notice that the project will be unavailable.
  2. Right-click the project again and select the Edit SampleProjectName.csproj option.
  3. In the .csproj file, find the <SupportedCultures></SupportedCultures> tags. By default, the tags will be empty. So, add the cultures that you want to be supported, separating each with a semicolon if there are many.

For example: <SupportedCultures>fr-FR</SupportedCultures>

     4. Save the project and reload it by right-clicking on the SampleProjectName.csproj. Then choose Reload SampleProjectName.csproj.

Step 3 – Assign Current UI Culture to the Application

By default, the current culture will be “en-US,” which you can check from System.Threading.Thread.CurrentThread.CurrentUICulture.

Now you can change CurrentUICulture as you want, as seen below.

Here, CurentUICulture should be set before IntializeComponent in your StartUp page (MainPage.xaml.cs) or you can set it in App.xaml.cs in the Application_Startup event.

public MainPage()
{
   System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-FR");
   InitializeComponent();
 }

Or in the App.xaml.cs file …

 private void Application_Startup(object sender, StartupEventArgs e)
 {
   System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-FR");
  this.RootVisual = new MainPage();
   }

Output

 

Ribbon Control for Invariant Culture

 

French Culture Assigned as Current UI Culture for Ribbon Control

 

Customization Dialog for Invariant Culture

 

French Culture Assigned as Current UI Culture for Customization Dialog

Conclusion

The same pattern is applicable to all other Syncfusion Tools Silverlight controls, and other packages will have this support added on or before the 2010 Volume 4 release. We welcome your valuable feedback about this feature to enhance support for Volume 3, which is scheduled for mid July.

Meet the Author

Vijayanand S