Home  /  Questions  /  Question



M S
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

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

http://timheuer.com/blog/archive/2009/08/26/silverlight-string-localization.aspx

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">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>10.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{44ABB2E8-AF39-4622-A73D-9FFD0310D1BE}</ProjectGuid>
    <ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Silverlight_Patterns_in_Action</RootNamespace>
    <AssemblyName>SilverlightPatternsInAction</AssemblyName>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
    <SilverlightApplication>true</SilverlightApplication>
    <SupportedCultures>en-US;ru-RU</SupportedCultures>
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.

FYI:

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