WPF: localization Basics

Source: Internet
Author: User
Specify the current localization information in the project file <project_name>. csproj:
<Propertygroup>
<Uiculture> en-US </uiculture>
</Propertygroup>

Rebuild Will Generate debug \ en-US \ <project_name>. Resources. dll


You need to use X: UID to set a unique identifier for each uielement:

<Button X: uid = "btntest"> test localization </button>

You can use the tool to generate automatically:
Msbuild/T: updateuid <project_name>. csproj


Generate a localized text file for the current language-<project_name>. Resources. CVS
:
Locbaml/parse en-US \ <project_name>. Resources. dll

Manually modify and save it as a text file in the target language-<Project_name>. Resources. Chinese. CVS

Create directory: Debug \ ZH-CN

Create the target language library-ZH-CN \ <project_name>. Resources. dll:
Locbaml/generate en-US \ <project_name>. Resources. dll
/Trans: <project_name> .resources.french.csv
/Cul: ZH-CN
/Out: ZH-CN


Localized changesCode:
UsingSystem. Threading;
UsingSystem.

PublicMyccapp ()
{
Cultureinfo CI = new cultureinfo ("ZH-CN ");

Thread. currentthread. currentculture = CI;
Thread. currentthread. currentuiculture = CI;
}

Note:
Locbaml tool sample (download) (compilation required. After compilation, copy the EXE file to the bin \ DEBUG directory)
Culture name (view)

Pai_^ supplement:
After writing the essay, I saw an articleArticle, The content is surprisingly similar (localization in WPF), and it is more concise and easy to understand than I wrote, Khan!
Suddenly: the innovation of technology followers was originally an imitation. Khan, we were the same, yeah!
Tomorrow, I will change my mind to an artist. I will first design a big profile picture for myself and mount it to the Internet with the post "True Originality: Self-blind painting ". Pai_^

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.