Localization tips
Design your app to work in any locale
You cannot assume anything about the device on which a user runs your app. The device might have hardware that you were not anticipating, or it might be set to a locale that you did not plan for or that you cannot test. Design your app so that it functions normally or fails gracefully no matter what device it runs on.
Important: Make sure that your app includes a full set of default resources.
Make sure to include res/drawable/ and a res/values/ folders (without any additional modifiers in the folder names) that contain all the images and text that your app needs.
If an app is missing even one default resource, it doesn't run on a device that is set to an unsupported locale. For example, the res/values/strings.xml default file might lack one string that the app needs: When the app runs in an unsupported locale and attempts to load res/values/strings.xml, the user sees an error message and a Force Close button.
Design a flexible layout
If you need to rearrange your layout to fit a certain language (for example German with its long words), you can create an alternative layout for that language (for example res/layout-de/main.xml). However, doing this can make your app harder to maintain. It is better to create a single layout that is more flexible.
Another typical situation is a language that requires something different in its layout. For example, you might have a contact form that should include two name fields when the app runs in Japanese, but three name fields when the app runs in some other language. You could handle this in either of two ways:
Ø Create one layout with a field that you can programmatically enable or disable, based on the language, or
Ø Have the main layout include another layout that includes the changeable field. The second layout can have different configurations for different languages.
Avoid creating more resource files and text strings than you need
You probably don't need to create a locale-specific alternative for every resource in your app. For example, the layout defined in the res/layout/main.xml file might work in any locale, in which case there would be no need to create any alternative layout files.
Also, you might not need to create alternative text for every string. For example, assume the following:
· Your app's default language is American English. Every string that the app uses is defined, using American English spellings, in res/values/strings.xml.
· For a few important phrases, you want to provide British English spelling. You want these alternative strings to be used when your app runs on a device in the United Kingdom.
To do this, you could create a small file called res/values-en-rGB/strings.xml that includes only the strings that should be different when the app runs in the U.K. For all the rest of the strings, the app falls back to the defaults and use what is defined in res/values/strings.xml.