Android internationalization - Developing in Android Studio

Asked

Viewed 308 times

0

How should I apply internationalization to an Android app,using various languages?

I need to develop an Android application where the original words in Portuguese should be translated into the following languages : German, Arabic(Saudi Arabia), Chinese, Greek and Italian!

I already have a file inside my values folder: strings.xml.. and created the folder for the languages (where the corresponding strings are), but when I emulate the applications in foreign languages the words continue in Portuguese!

My strings from each country already present the translated words, so much so that the files when open have the flag icon of the countries!

Below is the image of how folders are named

Pastas

<string name="app_name">Esercizio di internazionalizzazione</string>
<string name="país">Italia</string>
<string name="comida">Pizza</string>
<string name="food">Pizza</string>
<string name="bandeira">Bandiera dell\'Italia</string>



 <string name="app_name">Exercício Internacionalização</string>
    <string name="país">Brasil</string>
    <string name="comida">Feijoada</string>
    <string name="bandeira">Bandeira do Brasil</string>
    <string name="food">Feijoada</string>

Is there a right way to name folders? I’m making some wrong step?

  • You translated and included the strings in the respective folders?

  • ramaral - I opened my string where the English words are, then I read the language editor.. I added the language and made the translations.. folders were created according to what you said ,but still does not translate

  • 1

    I see nothing wrong.

  • ramaral would be able to talk to you through the stack’s "chat"? so I can show you the codes, because I can’t see where it’s wrong

  • All indicates that yes, however check if the strings were created in the respective Strings files. As you are doing in the emulator?

2 answers

1


The features of the application are loaded at the startup of the application and creation of the components, according to the settings set in the system. To test your app in Chinese, one of the simplest alternatives is to set the system language to Chinese and open the app again.

You can also change the language settings of the application programmatically (in Runtime) as the post explains How to change the language on Android at Runtime and don’t go Mad, which includes code snippets for different API levels.

Directories should be named according to the default BCP 47. Try using values-ar, values-de, values-el, values-it and values-zh.

  • Mathias - When creating folders, translating words into the corresponding language, strings will already be created automatically in these folders?

  • Folders are well named, When you want to specify a regional variant it must be specified with -rREGIÃO.

  • @Carolm supposedly the editor should rather store an XML file with the strings inside the correct folder. In terms of structure, all files will be equal, changing only the values (texts). You can check by opening the file strings.xml of each folder and checking whether it matches what you wrote in the visual editor.

  • @ramaral according to the validator available at http://schneegans.de/lv/, some names are not valid. Anyway, renaming the folders so as to make the location more comprehensive can be a good way to test and limit the causes of the problem.

0

It took me a while to close the question , sorry! I was able to find the error,I had not put @string in Id and Description!

  • You tried to post a comment and ended up posting a reply, because you must have used without noticing the text box for answers. Look to use for comments the comment option, is more appropriate for this.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.