Localizing the Strings

In this app, the GUI contains one TextView that displays a string and two content-description strings for the ImageViews. All of these strings were defined as string resources in the strings.xml file. You can now translate the strings in the new version of the strings.xml file. App-development companies often have translators on staff or hire other companies to perform translations. In fact, in the Google Play Developer Console—which you use to publish your apps in the Google Play store—you can find translation-services companies. For more information on the Google Play Developer Console, see Chapter 9 and

For this app, you’ll replace the strings

"Welcome to Android App Development!"
"Android logo"
"Deitel double-thumbs-up bug logo"

with the Spanish strings

"¡Bienvenido al Desarrollo de App Android!"
"Logo de Android"
"El logo de Deitel que tiene el insecto con dedos pulgares
   hacia arriba"

To do so:

1. In the IDE’s Package Explorer window, double click the strings.xml file in the values-es folder to display the Android Resources editor, then select the welcome string resource (Fig. 2.26).

Image

Fig. 2.26 | Android Resources editor with the welcome string resource selected.

2. In the Value field, replace the English string "Welcome to Android App Development!" with the Spanish string "¡Bienvenido al Desarrollo de App Android!". If you cannot type special Spanish characters and symbols on your keyboard, you can copy the Spanish strings from our res/values-es/strings.xml file in the final version of the Welcome app (located in the WelcomeInternationalized folder with the chapter’s examples). To paste the Spanish string into the Value field, select the English string, then right click it and select Paste.

3. Next, select the android_logo resource and change its Value to "Logo de Android".

4. Finally, select the deitel_logo resource and change its Value to "El logo de Deitel que tiene el insecto con dedos pulgares hacia arriba".

5. Delete the app_name, action_settings and hello_world string resources by selecting one at a time and clicking the Remove... button. You’ll be asked to confirm each delete operation. These three resources were placed in the default strings.xml file when you created the app’s project. Only the app_name string resource is used in this project. We’ll explain why we deleted it momentarily.

6. Save the strings.xml file by selecting File > Save or clicking the Image toolbar icon.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset