Testing localized apps
Testing on a device
Keep in mind that the device you are testing may be significantly different from the devices available to consumers in other geographies. The locales available on your device may differ from those available on other devices. Also, the resolution and density of the device screen may differ, which could affect the display of strings and drawables in your UI.
To change the locale or language on a device, use the Settings app.
Testing on an emulator
For details about using the emulator, see Android Emulator.
Creating and using a custom locale
A "custom" locale is a language/region combination that the Android system image does not explicitly support. You can test how your app runs in a custom locale by creating a custom locale in the emulator. There are two ways to do this:
Ø Use the Custom Locale app, which is accessible from the app tab. (After you create a custom locale, switch to it by pressing and holding the locale name.)
Ø Change to a custom locale from the adb shell, as described below.
When you set the emulator to a locale that isn't available in the Android system image, the system itself displays in its default language. Your app, however, should localize properly.
Changing the emulator locale from the adb shell
To change the locale in the emulator by using the adb shell.
1. Pick the locale you want to test and determine its BCP-47 language tag, for example, Canadian French would be fr-CA.
2. Launch an emulator.
3.
From a command-line shell on the
host computer, run the following command:
adb shell
or if you have a device attached, specify that you want the emulator by adding
the -e option:
adb -e shell
4.
At the adb shell prompt (#), run
this command:
setprop persist.sys.locale
[BCP-47 language tag];stop;sleep 5;start
Replace bracketed sections with the
appropriate codes from Step 1.
For instance, to test in Canadian French:
setprop persist.sys.locale fr-CA;stop;sleep 5;start
This causes the emulator to restart. (It looks like a full reboot, but it isn't.) Once the Home screen appears again, re-launch your app, and the app launches with the new locale.