Home  /  Questions  /  Question

50   50
Aug 31, 2010

Silverlight localization

I'm looking how localization was handled in the SilverLight Patterns 4.0 and noticed that in ApplicationStrings.Designer.cs resourceCulture is null for each public static string property.  Why is this null?

I also noticed that ApplicationStrings.resx in Silverlight Patterns in Action | Assets | Resources is not ApplicationStrings.en-US.resx.  If I want to support another language I would have to add ApplicationString.fr-BE.resx under Resources.  How would this file get loaded if the local culture is Belgium?

Do you not have to register supportedcultures?  <SupportedCultures>en-US;fr-BE</SupportedCultures>

830   99.9
Aug 31, 2010
Hello M S:

The Design Patterns Framework does not demonstrate localization. The emphasis in the Design Pattern Framework is on when and how to use Design Patterns. Our feeling was that if we had included localization it would have 'muddied the waters' and made the learning experience more complicated.

That said, the Design Pattern Framework is like any other .NET application and supports localization.

Hope this helps.
 1 comment
Thanks for your explanation. --- M S  Aug 31, 2010

50   50
Sep 01, 2010
I have localization working in Silverlight Patterns 4.0 by following:


The link is well written except for the following bold text before Step 5: Testing it out.

It states:

UPDATE: Forgot one critical step – oops.  You have to manually edit your **proj (csproj/vbproj) file for your Silverlight project to add the locales in the SupportedCultures node of the proj file.  This is a manual step (and sucks), but don’t forget it or nothing will work as you suspect.

To do this:

1) Right click Silverlight Patterns in Action project and select UnLoad Project context menu item.

2) Right click Silverlight Patterns in Action project and select Edit Silverlight Patterns in Action.csproj context menu item.

3) Add the new cultural name to <SupportedCultures>en-US;ru-RU</SupportedCultures>.  I have en-US and ru-RU.  Ensure you have a semi colon ';' sperating the two.

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
4) Right click Silverlight Patterns in Action project and select Reload Project context menu item.
5) Click 'Yes' if a dialog displays asking to close Silverlight Patterns in Action.csproj.

I verified by changing my display language of the windows environment to Russian:
Select Region and Language from the Control Panel,
Select the Keyboards and Languages tab.
Select a language from Choose a display language: combo box.
If the language is not listed, install the language by clicking Install/uninstall languages... button.
After selecting you need to restart your computer and run the Silverlight Patterns in Action project.

Remember that upon restarting some window text will be in the language that it was changed to so you may or may not have problems finding your way around.


I'm using VS2010 on a Windows 7 Ultimate 64-bit