When we speak about application or game localization (or L10N, which means L followed by 10 letters and N), we generally mean supporting multiple languages. Another term is internationalization (or I18N), which means adapting the game to different regions. An example of I18N would be supporting both metric and imperial systems of units or supporting multiple date formats.
Localization in Android is very simple. The first step is to keep all the strings separate from the code. Instead of hardcoding Hello world!
, we put this string into an XML resource file called strings.xml
. This file is located at res/values/
.
Tip
Keeping the strings separated from the code is a good practice even when we support only one language.
When we created the application, the Eclipse new app wizard already put some strings there. The following code shows how the file should look:
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">LearningAndEngine</string...