Introduction
The recent project to localize in the Silverlight 2 application was thought to be a very simple process, but it didn't occur when it was twists, but the results were pretty good. The requirement is this, when the user first visits, the default is English, when the user chooses a display language, the record is local, the next time users visit directly show the language you have selected. Now I have recorded the whole process of realization and I hope it will help.
A wry smile without blemish
At the end of the multi-language support implementation (above) article in Silverlight 2, we achieved multi-language support by modifying supportedcultures in the project file because there were only two languages in the previous example, Chinese and Chinese, Now we add a resource file Strings.fr-fr.resx to enable it to support French, as shown in the following figure:
Thanks to my colleague Fabien for helping me translate it into French, we also open the project file and add a language culture fr-fr to supportedcultures, which we can split with commas or semicolons, as shown in the following code:
Now we extract the Xap file, you can see FR-FR, ZH-CN resource files are properly packaged in the XAP file, the following figure:
Now when you run the program, you find that the Chinese language culture cannot be displayed, and the French can display it correctly:
This is a bug that Silverlight 2 Beta 2 supports in localization, and it can only support a language other than the default language. A friend might ask, why is it not Chinese in this example, but French, since it can support a language other than the default language? This is mainly in the language and culture set up in the SupportedCultures, after compiling, packaging to AppManifest.xaml to add Assemblypart is in accordance with the alphabetical order of language and culture, so will default to support the top one language culture:
Okay, now that you know that in Silverlight 2 Beta 2, you can support up to two languages, and hopefully at RTM the problem is gone.