Silverlight 2 Multi-language support implementation (top)

Source: Internet
Author: User

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.

Preparatory work

We found that the ResourceManager class was provided in Silverlight 2, which means that it can be implemented through a resource file, first creating a folder in the Silverlight project, named Resources, Add a resource file Strings.resx and add a few values, as shown in the following figure:

The file will be the default resource file, setting access modifier to public, and it will generate the Strings.Designer.cs file, as shown in the following illustration:

Now create a few other language resource files, such as Chinese, French, Norwegian, and so on, note that the name of the resource file is made up of strings+ language and culture, the code for each language file, you can consult MSDN.

The access modifier for these other files is set to No Code generation. With these previous preparations, the implementation is followed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.