One underutilized method of gadget spread is Internationalization.
Google gadgets that are only listed in the English language are missing tens of millions of potential users.
The Google gadget directory, when seen in Italy, prefers to show Italian language descriptions and titles. They are more useful to Italian users. Also consider that when an Italian user is searching for a “cat” gadget they are actually typing the word “gatto”. They are looking for things in their own language. This is naturally true of all languages.
Consider this – There are currently no “gatto” (cat) gadgets in the entire Google gadget directory. If you do actually have a cat gadget, I highly suggest you internationalize it to get those Italians
Many gadgets are not language specific, for example a gadget displaying cute, adorable cat photos need not be limited to English or any other language. Clocks are another example of a non-language specific gadget.
If you have a Google gadget and want it to display in different languages when it is displayed in different countries, here is how you do so…
The best place to get information about Google is from Google itself. The process I am describing is documented at Google under their Gadgets and Internationalization Spec (i18n). This walkthru of the process is just a simplification of that spec.
Click the image below to see up close what the same gadget looks like when described in different languages.
There are basically three steps to gadget internationalization…
1. Decide which countries and languages you wish to cover and then acquire the translation of your gadget description and title.
2. Make small text files called “message bundles”
3. Edit your gadget code to include the language support.
Ready? Let’s go international.
First you need the translations. For most gadgets you need only translate two things, the title and the description, but you also can translate user preferences as well.
Translating your Google gadget title and description
Copy and paste your gadget description. Using the Panda gadget as an example the English description is…
“Adorable Panda bear for your homepage. Interact and feed your panda some bamboo.”
Go to Google’s translation tool and paste your description into the text field…
Choose the language you description is in and then choose the language you want it translated into, in this case I am translated my English description into Korean. Click the translate button….
Now copy and paste your translation and save into a text file. Repeat this process for your gadget title.
Congrats! You now have a Korean description and title of your gadget. Now let’s set up our gadget to display the Korean description when someone in Korea is looking at it…
A message bundle is a small simple xml file that contains callable information. For example, when Google detects that someone in Korea is looking at your gadget it will look for a Korean “message bundle” if you have instructed it to do so in the gadget code (we will discuss that part in a minute). This message bundle is just a small text file which the gadget calls to display the Korean text. The below image shows the code…
The above file is called for the Panda gadget when it is being displayed in Korea. The above shown code is the entire message bundle. It may look a bit scary in Korean, but if you look closer you are only defining three things…
Title, description, and Directory_title (which is for almost all purposes the same thing as the title).
To make your own message bundle follow this link to go to the above code. Important! When you go to that file make sure to left click and choose “view source”. Copy and paste the code into a text editor and save it as “ko_ALL.xml” (I will explain why is a second). Take the title and description translation you created in the first step and paste them in the appropriate parts of the code.
Paste the title you translated and paste inbetween the <msg name=”title”> and the </msg> tags. Also place the title translation in the “directory_title” part too. <msg name=”Directory_title”></msg> Now do the same for your description.
For each language you need a separate message bundle file. These files must be hosted somewhere, they will be called from your Google gadget code, as described below.
Altering Google gadget code for internationalization
In order to take advantage of Google’s impressive geo location abilities, we must first add some code to our gadget.
In order to display the information contained in the message bundles (the translations) you must first call for them. Google will figure out where the user is coming from, but you must tell Google what to do with that information.
The way to do this is by changing some information in the ModulePrefs of your existing gadget. If you do not know what moduleprefs are you may want to see my Google gadget tutorial.
ModulePrefs (Module Preferences) is the first part of a Google gadget code and it’s function is to tell Google certain things that are specific to that gadget. Things like the title, the author, etc. If you already have a Google gadget, you already have a ModulePref section.
In the image below I have circled the parts of the ModulePref that I have altered in the Panda gadget to make it international…
Notice that the title and the descriptions are now calling a variable instead of just using text.
I also changed the directory title pref…
By changing these values I have now made them variable which means that Google can decide what to put in those fields depending on what language Google detects is being used.
Now the big chunk of code I have entered is the Locale part. Let’s look closer at what it is doing in there…
The first line tells Google where to find your default message bundle. The default one is named “ALL_ALL.xml.
The info in the ALL_ALL.xml message bundle is the default info that should be displayed in case thing go kooky or something does not work, so this is an important one. This should be a message bundle in the default language of the gadget. In the case of our Panda example it is in English. See the ALL_ALL.xml file for the panda gadget here.
Each message bundle is exactly the same code, just different content for different languages. Each message bundle is named something different depending on what language is contained within it. For each language you choose to cover with your gadget, you must tell Google. this is what the remaining code in the image above is doing. For example let’s look at the Korean message bundle we made above and how it is listed in the gadget code:
<Locale lang=”ko” messages=”http://www.gadzi.com/gadgets/panda/ko_ALL.xml>
This line says to Google “If someone using Korean is looking at this gadget – use the information contained in the message bundle ko_ALL.xml”
Each of the lines you see in the code image above are just repeats of this same message for different languages.
So to change the gadget code we had to make the title, description, and the directory_title variables.
We then had to add a line telling Google where to find the default information for those variables.
We then had to provide a line of code telling Google which message bundle to use for each language we want to cover.
To learn more go to Google’s documentation: Gadgets and Internationalization Spec (i18n)
To see the panda gadget example code go to: Panda Gadget Example code
To see how the Google gadget directory displays languages go to: Google Gadget International Usage