Android app support multiple languages

2019-01-20 12:01发布

问题:

If I want to upload my Android app with an aim of supporting multiple languages, do I have to upload multiple .apks, each designed for the language I would like to support, or do I implement it all into one .apk file?

Note: My app is a game and does not really not contain any Strings in the UI. The UI was made using Photoshop, eg the buttons with text and so on.

If I pack all the languages into one .apk file, how do I check which language the app should use?

Update:

All my images are stored in the assets folder of my project. How would I localize them?

回答1:

No, you don't need to create multiple APKs, just single APK with Localization, see this http://developer.android.com/training/basics/supporting-devices/languages.html and this http://developer.android.com/guide/topics/resources/localization.html



回答2:

before given your question answer,i tell you about multilingual in android basically in android application work in region wise means if i have device in usa -> install one application ->once it install if application was developed for multilingual support then it automatically render those string.

-> now question is how application build in multilingual for that you have to define string.xml for each language for your application will supports.

--for example : res/values <= default --for Spanish : res/values-es

--for your question answer : if you define image with static way then it does not work.



回答3:

For games that have images containing text you can use the same method as for normal strings.

Lets say, for strings you will have a strings.xml file under

values-en
values-es
values-de
values-fr

Then for images you can use (beware of the qualifiers precedence)

drawable-es-hdpi
drawable-en-hdpi
drawable-de-hdpi
drawable-fr-hdpi

However this will make your app bigger.

What I usually do is to generate the images programmatically, using a background and then rendering the text using some custom font on top of it. Even if the images are textures to be used on a 3D engine it works fine and I believe is a more reasonable approach.