- Create three folders in your project root:
| --strings | --en-US | | --de-DE (or another language and country code)
- Then create in your in each of your two subfolders a Resource File (*.resjson):
| --strings | --en-US | | | --resources.resjson | --de-DE (or another language and country code) | --resources.resjson
- Enter your strings in JSON format.
- i18n in your HTML:
<element data-win-res="{textContent: '[resStringName]'}"></element>
- Call WinJS.Resources.processAll() in your JavaScript, after the DOM was loaded, e.g.:
var app = WinJS.Application; // ... app.onloaded = function (args) { WinJS.Resources.processAll(); }
- i18n in your JavaScript:
var str = WinJS.Resources.getString("[resStringName]").value;
Tuesday, June 5, 2012
5 steps for i18n in Windows 8 Metro style apps (JS)
Labels:
apps,
i18n,
javascript,
Metro style,
programming,
Windows8
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment