* The article source is from Udacity Nanodegree Program- Become an Android Developer *
Localization
Localization (also known as Internationalization) is the adaptation of a product or service to meet the needs of a particular language, culture or desired population’s “look-and-feel”.
I. Translation:
You should always design your app in a way that can be easily translated to other languages. To do so, any text that you would expect to be translated like labels and titles and button descriptions should all be defined as a string resource in res/values/strings.xml
This allows you to create other versions of strings.xml
for other languages. This is done by creating a new values
folder with the pattern value-xx
where xx
can be the abbreviation of any language from the ISO 639 code list here, for example res/values-fr/strings.xml
will contain the french version of the strings.xml file with all the strings translated from the default language to french.
This way, when a user who has set up their phone to use french as the default language, android will automatically load the french version of strings and use all the pre-translated french labels.
II. RTL support
If you’re distributing to countries where right-to-left (RTL) scripts are used (like Arabic or Hebrew), you should consider implementing support for RTL layouts and text display and editing, to the extent possible.
You’ve already seen how to set image recourses to flip when RTL support activated to indicate the correct direction of travel using
<vector android:autoMirrored="true"> </vector>
Another set of attributes related to RTL support are the
android:layout_marginStart
android:layout_marginEnd
that correspond to
android:layout_marginLeft
android:layout_marginRight
respectively, but only when the default language is English (or any LTR language), for RTL languages however, Start is mapped to Right and End is mapped to Left instead, the idea is that when the app runs on a device with a default RTL language , everything will get mirrored by switching margins and constraints to the other side.
This Localization Checklist offers some more important steps you should follow to make your Android app run on many devices in many regions and hence reach the most users.