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/
Related
If I have XML file and it was wrote in Arabic, but my application supports 2 languages (Arabic & English), is there any way to change the sentences in XML file to English when the user changes the language of the app?
I think Official Documentation is written in pretty well methodology -
So here I'm providing you that links -
Let me entitle it as -
Thing to be taken care of while you are developing an App with muti-language support
Localization Checklist
Writing style
XLIFF - XML Localisation Interchange File Format
Ps, First link is the parent of all, Go there - Its pretty interestring stuffs out there!
Everything you need is explained in the official Android Documentation.
You should create strings.xml for Arabic and English languages
You can create different XML files for different languages. The app/android will choose in condition to the system language which XML too choose.
You just have to create a new folder called values-ar in res/ where you put your Arabic strings.xml
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 project that I developed one year ago. I didn't think in do the project multi-language and now I need support it.
There are any easy way to detect all strings and generate the XML file? Or I need modify the project string for string?
The project is developed in Eclipse.
Android provides a very simple way to localize apps: string resources.
You need to provide several strings.xml files.
Each in a directory called /res/values-xy, where xy is the language (i.e.: es, fr, en, de, it, ...).
Then just refer these strings in your project, like R.string.my_string_name (in Java) or #string/my_string_name (in xml)
For reference: http://developer.android.com/training/basics/supporting-devices/languages.html
[EDIT]
Same goes for arrays: just use /res/values-xy/arrays.xml
Note: the names strings.xml and arrays.xml are just conventional ones can be changed to anything you like better.
AFAIK You need to modify the strings in your project manually. If you have hard-coded strings in your layouts then you can use Lint to find out all the hard-coded strings. Put them then into values/strings and the translation should go to the respective folder of each language.
EDIT:
If you're running Eclipse you can use the search feature to help you track all your hard-coded String. Check this topic
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? :)
I want to set in my android app more languages : english, french, german,italian. That's mean that when I choose one of them in the app all the text from textviews, button..will appear in that language. How can I do that? Should I save the words from all app in a local SQlite database ? Can you provide me some examples? Thanks in advance.
All the techniques you need are covered in the Localization guide.
You can use the res/values/strings.xml in your ressource folder.
After that you can create multiple folders, e.g. "values-en" for the english strings.xml
or values-fr/strings.xml for french. Check this link.