Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

Gadgets i18n tool is an all-in-one tool for localizing gadgets and OpenSocial applications. It helps with app internationalization (i18n), handling everything from translation to message bundle generation. And all that's required is a PC running Windows XP or Vista with version 2.0 of the .NET framework installed.

Installation

You need to have .NET framework 2.0 for Windows XP or Vista in order to run this tool. This can be downloaded from here.

First download the zip archive and extract it somewhere on your hard drive. The package contains an installer named setup.exe. Once installed, it can be launched from Start menu > gadgetsi18ntool > gadgetsi18nTool.exe.

Generating an English message bundle from source HTML

Step 1: Creating the message bundle

First, you must copy the HTML present in all <Content> tags of your gadget XML to a separate text file (let's call it contents.txt). Remove the <script> and <style> tags for faster execution.

Now open the gadgets i18n tool, click "Browse source HTML file," and select the contents.txt file you just created. Clicking the button labeled "generate English message bundle" will create a en_ALL.xml message bundle file in same directory as the HTML source in content.txt.

Here is an example of what it will do:

Input - content.txt

<div>Hello World</div>
<span>foo <b>bar</b></span>

Output - en_ALL.xml

<?xml version="1.0" encoding="utf-8" ?>
<messagebundle>
  <msg name="str0">Hello World</msg>
  <msg name="str1">foo</msg>
  <msg name="str2">bar</msg>
</messagebundle>

Step 2: Making the substitutions

Now that we have an English message bundle, we have to replace the occurrences of strings in the HTML source with their

__MSG_str__

equivalents in the message bundle we generated.

To do this, click the button labeled "substitute strings in source HTML." It will create a new file named

contents_i18n.txt

with the appropriate substitutions. Here is the sample output:

Output - contents_i18n.txt

<div>__MSG_str0__</div>
<span>__MSG_str1__ <b>__MSG_str2__</b></span>

Translating a message bundle to other languages

So now you have English message bundle and a localization ready HTML content. All that's left is translating the English message bundle to other languages. Gadgets i18n tool can generate the message bundle in 22 languages using the Google translation APIs with a single click.
You can individually select languages in drop down or check the box for selecting all languages to translate to in a single shot!

Optionally you can give location of folder through which message bundles can be accessed on web and the tool will give you code to be copied into the gadget xml for putting them in place. Click the "generate translated Message Bundle" button to start fetching translations. The message bundles will be saved in same directory as English message bundle with language codes in file names.

More...

I plan to do a web app of the tool that does the same thing as the desktop version in near future. Let me know your views on whether to keep it as a handy desktop tool or a multi-platform web app. Gadgets i18n tool is coded in C# .NET, source code is available. Please feel free to give suggestions, port tool to other platforms like Mac, Linux and report bugs on project's portal - http://code.google.com/p/osi18ntool/

Other resources

http://code.google.com/p/opensocial-resources/wiki/OrkutLocalization

http://code.google.com/apis/gadgets/docs/i18n.html

  • No labels