1.material
How to use the Multilingual App Toolkit (Windows):http://msdn.microsoft.com/en-us/library/windows/apps/jj569303.aspx
Quickstart: Translating UI resources (Windows Store apps using JavaScript and HTML) (Windows):http://msdn.microsoft.com/en-us/library/windows/apps/hh943060.aspx
2.downlaod and install
Download and install the toolkit from Multilingual App Toolkit for Visual Studio 2012.
3.Translating UI resources
- Open package.appxmanifest in Visual Studio, go to the Application UI tab, and set your default language to "en-US".
Note This specifies the default language for the project. The default language resources are used if the user's preferred language or display languages do not match the language resources provided in the application. See Property Pages, JavaScript.
- Create a folder to contain the resource files.
- In the Solution Explorer, right-click the project and select Add > New Folder.
- Name the new folder "strings".
- If the new folder is not visible in Solution Explorer, select Project > Show All Files from the Microsoft Visual Studio menu while the project is still selected.
- Create a sub-folder and a resource file for English (United States).
- Right-click the strings folder and add a new folder beneath it. Name it "en-US". The resource file is placed in a folder that has been named for the BCP-47 language tag. See How to name resources using qualifiers for details on the language qualifier and a list of common language tags.
- Right-click the en-US folder and select Add > New Item….
- Select "Resources File (.resjson)".
- Click Add. This adds a resource file with the default name Resources.rejson. We recommend that you use this default filename. Apps can partition their resources into other files, but you must be careful to refer to them correctly (see How to load string resources).
-
The new file contains default content. Replace the content with the following (which may be very similar to the default):
strings/en-US/resources.resjson
{
"greeting" : "Hello",
"_greeting.comment" : "A welcome greeting.",
"farewell" : "Goodbye",
"_farewell.comment" : "A goodbye."
}This is strict JavaScript Object Notation (JSON) syntax where a comma must be placed after each name/value pair, except the last one. In this sample, "greeting" and "farewell" identify the strings that are to be displayed. The other pairs ("_greeting.comment" and "_farewell.comment") are comments that describe the strings. The comments are a good place to provide any special instructions to translators who localize the strings to other languages.
3.To enable the Multilingual App Toolkit:
- Open the project solution file.
- Select the desired project in the solution explorer.
- On the Tools menu, select Enable Multilingual App Toolkit.
4.translate
4.1 translate in html
in html:
<body id="privacy_body">
<h2 data-win-res="{textContent: 'Privacy'}"></h2>
</body>
in js:
WinJS.Resources.processAll(document.getElementById('privacy_body'));
it will translate all child elements in ‘privacy_body’,to current items.
4.2 translate in javascript code
var str = WinJS.Resources.getString('scenario3Message').value;
5. generate translate message
5.1 build the project,it will need generator some content.
5.2 right click “MultilingualResources/pkrss_xxx.xlf”, click the menu item“generate machine translate”.
6 comments:
I'm pretty pleased to find this great site. I need to to thank you for ones time for this fantastic read!! I definitely really liked every part of it and i also have you saved as a favorite to check out new stuff on your site.
I'm really loving the theme/design of your website. Do you ever run into any web browser compatibility problems? A couple of my blog visitors have complained about my website not operating correctly in Explorer but looks great in Safari. Do you have any suggestions to help fix this issue?
I usually do not leave a ton of remarks, but i did a few searching and wound up here windows8 develop metro sample code-5 Multilingual App Toolkit(mat) |
pkrss blog. And I do have 2 questions for you if it's allright. Is it only me or does it look as if like some of the responses look as if they are coming from brain dead individuals? :-P And, if you are posting on other online sites, I'd like to follow everything new you have to post.
Would you make a list of all of your public sites like your Facebook
page, twitter feed, or linkedin profile?
Simply wish to say your article is as amazing. The clarity in your post is
just excellent and i can assume you're an expert on this subject. Fine with your permission let me to grab your feed to keep up to date with forthcoming post. Thanks a million and please carry on the enjoyable work.
I simply couldn't leave your web site before suggesting that I actually loved the usual info a person supply on your guests? Is gonna be again continuously to inspect new posts
This design is wicked! You most certainly know how to keep a reader entertained.
Between your wit and your videos, I was almost
moved to start my own blog (well, almost...HaHa!) Excellent job.
I really enjoyed what you had to say, and more than that, how you presented
it. Too cool!
Post a Comment