Archive for March, 2009

Testing Android Localization with SKD 1.1

Tuesday, March 31st, 2009

Update (April 2nd 2009): the draft document has now been updated with similar instructions to the ones below.

The draft document for localization on theĀ  Android platform has not been updated to support the 1.1 SDK yet and the method described there does not work.

It is possible to use the Settings -> Locale & Text-> Select locale preference to change the locale but this only works for the predefined locales shipping with the emulatorĀ  (currently DE, US, GB).

To test a different locale, you need to modify /data/property/persist.sys.language and /data/property/persist.sys.country. The change will be reflected after an emulator restart. Note that the “stop; sleep 5; start” mentioned in the official document does not work, you need to exit from the emulator.

So for instance, to change the locale to fr-FR, once you have the emulator running, start "adb -e shell" and type:


echo fr-FR >/data/property/persist.sys.language

echo FR >/data/property/persist.sys.country

Exit from the emulator and once you restart, the locale will be set correctly and be persistent across restarts. If the locale is not one shipping with the SDK, only your own application(s) will be translated, the default applications will still be using the default English values.

You may also want to use different images for testing so that you don’t have to redo the above steps each time as it’s easier to update the tested application for each image. To do that, use the “-data” option when starting the emulator, e.g.:

emulator -data /home/xlv/dev/android/emulator_files/fr.img

Using those steps, I was able to make sure that the Who Called? application was correctly translated in French (”Qui C’est?”):

Qui C'Est?