Chapter 18 Localization
Now it is time to make the magic happen. Add Spanish versions of all your strings to res/values-es/
strings.xml. (If you do not wish to type these strings in, copy the contents from the solution file. You
can find the URL in the section called Adding an Icon in Chapter 2.)
Listing 18.1 Adding Spanish alternative of string resources
(res/values-es/strings.xml)
El crimen fue descubierto el %2$s. %3$s, y %4$s
That is all you have to do to provide localized string resources for your app. To confirm, change your
device’s settings to Spanish by opening Settings and finding the language settings. Depending on your
version of Android, these settings will be labeled Language and input, Language and Keyboard, or
something similar.
When you get to a list of language options, choose a setting for Español. The region (España or
Estados Unidos) will not matter, because the qualification -es matches both. (Note that on newer
versions of Android, users can select multiple languages and assign a priority order. If you are on a
newer device, make sure Español appears first in your language settings list.)
Run CriminalIntent and bask in the glory of your newly localized app. When you are done basking,
return your device’s language setting to English. Look for Ajustes or Configuración (Settings) in the
launcher and find the setting that includes Idioma (Language).