My default app language is English so strings.xml is located under res\values.
My app should also support Hebrew, so I put a Hebrew copy of strings.xml under res\values-he.
My problem is that on some devices, Hebrew is defined as "iw" (instead of "he").
Is there a way to save me the trouble of another copy of strings.xml under res\values-iw, but to have one folder to handle he,iw and use the default values folder for all the rest?
It's a known issue and already answered here:
CyanogenMod: Translate a Project
So if you want full support on all devices, you have to include both versions.
It's just copy & paste, where's the trouble? :)
Related
This question already has answers here:
Android localization values-** folder names
(3 answers)
Closed 3 years ago.
I created an Android app that is provided in several countries (no surprise so far ;-)). But I want to use the resource file, that contains German strings in Germany, Swiss and Austria. Do have to copy the file two times or is there better way how to handle this?
You put language specific files(string, images, styles, etc) to language specific values folder. For instance for German, create a folder named values-de, can also use country specific codes too. values-pt for Portuguese, and values-pt-rBR for Brazilian.
You can find the codes for languages or use Translation Editor of Android Studio which creates folders for you. Another thing with Translation Editor it helps you to filter for text and has some other extra cool features.
You can use the translation editor (open your "string.xml" and click on "Open editor" at the top right corner). It will manage the other files for you.
I have submitted an Android app to Google Play and I see that I can create different descriptions for each language it supports. My question is: can I create a different APK for each language? Alternatively, how can I detect the user's preferred language, so that I can automatically activate that language for the user in the app?
Here is the official tutorial for localizing your app. :)
You can create a different apk for each language ( split-apk ) - but I would not recommend this. Better use the platform function for this and put your strings file in the right path ( values- ) - after this everything is automagically done
no just use the /res/values/strings.xml
for example to choose english language create a folder in same directory of values and call it values-en, for frensh values-fr and so on. the default language of the app is under values/
And if (for some reason) you still need to know witch is the devices language use
Locale.getDefault().getDisplayLanguage();
I have an android application on eclipse it's text-views and the buttons' texts on Arabic language , I want to localize my application to both Arabic and English users .
Firstly under res folder I have created another folder and named it values-en .
I let the original folder values as is it and later I will use it for Arabic .
My first question it is necessary to create another folder (values-ar) for Arabic localization issues.
Or original values folder is just enough?.
Secondly
On values-en folder I created strings.xml file and added the following statement to it
COMTAS
I set the text of one of the textviews from resource chooser so choose application-title .
after that the textview's text converted to #string/application-title.
the project gives me the following message
NOTE: This project contains Java compilation errors, which can cause rendering failures for custom views. Fix compilation problems first.
Can someone explains to me how to make localization in simple steps.
And how I can retrieve textviews' texts either in english or arabic (reading from values folder)?
First: Leaving a strings.xml in the "values" folder will cause this language to be "default" (or rather "fallback") language.
Second: The text is read automatically from the strings.xml placed in the values-folder matching your System Locale (the locale you get when you call Locale.getDefault()), e.g. if system locale is set to english, the values are taken from values-en folder. Therefore it would be wise to place the arabic values in a values-ar folder.
I can't say anything related to your compile errors as you didn't post the code causing the error.
It's always good to follow the documentation. Here is the link for Localizing with Resources.
Create a values-ar folder for the arabic language, and let the default language as english. Why?
Whenever the application runs in a locale for which you have not provided locale-specific text, Android will load the default strings from res/values/strings.xml.
So if your application is running on a device set to Spanish language, it would still load arabic language (if it's set as default).
English is a most talked language, which would be better to let english by default, ant let the arabic language in values-ar(in my humble opinion).
Hope this helps you.
I have android application developed in English language and also have content in English. Is this possible that all texts are converted in other language like in Chinese or Japanese, then How? some sample code or tutorial will help me lot.
I am able to get language selected through setting with code as follows.
Locale.getDefault().getDisplayLanguage()
The usual way to do this is to:
Enter your strings in a strings.xml file in the /res/values/ folder of your project. You can then define different localizations of your string file by added them to the localized /res/values/ folders. ( /res/values-jp/ or /res/values-en/ etc.)
See: Developer Android
We can also use translation api. Refer this Link
http://www.creatiosoft.com/how-to-use-microsoft-translation-api-in-android/
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?
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
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.
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.