how to setup property in string.xml? - android

i want to create an application in android ,for two country like U.S. or Japan.
my problem is that ,In my login or Registration forms labels are designed for once and use for both senario(countries).
This make sence by String.xml file . but how can ?
If any body knows then please give me idea.
Thanks in advance.

Create sub folders for different locale in the res folder.
Example:
res/values
res/values-in
res/values-fr
Copy strings.xml into those folders. One file per folder.
After that, change the languages for each strings.xml in respective to the folder. e.g., values-in for Indonesia, values-fr for France, etc.
Read this guide to further more explanation:
Android Localization

Related

Android localization resources

I have just finished developing an android application that I was asked to make. I had also planned to translate it in different languages; below you can see the tree of the folders/files:
Inside strings.xml there are all the values that I am using inside the classes and they are all in Italian, my language (Here you can see an example if needed). I'd like to be able to translate all those fields in English and french as well.
I have read this article -> http://developer.android.com/training/basics/supporting-devices/languages.html
From what I have understood, I'd have to create a folder called values-fr with a strings.xml inside (it will have the same values names, but different translations).
QUESTION
I would like to be able to support English and Italian as well, but I don't understand how to manage the folders. Could you please tell me which option is the correct?
Inside the folder values use strings.xml with Italian (my language) strings. Then create another folder called values-en and, like I did before, create strings.xml with English values
Inside the folder values use strings.xml with English strings. Then create another folder called values-it and then, create strings.xml with Italian values
I guess that the point 2 is the correct solution but I'm not sure. The folder values has English as default language?
Thanks for the attention.
Technically speaking both are valid. values/ is the fallback if a more specific qualifier is not found. There is no written rule that enforces you in having the English strings in values/. It just makes a little more sense to have the English as fallback since it easier to find foreigners that speak English rather than Italian

Android Localization structure of values folder

I`m still learning android development and come with one app which I want to localize to multiple languages.
But please help me a little bit with values folder structure. I have main values folder and in it I have analytics.xml, strings.xml,styles.xml,mraid_attr.xml and colors.xml.
When I make new folder for localization, eg: values-fr I must put all of these files in it or just string.xml where I have translated strings?
You can just put your translated strings in your localization folder, but Lint will warn you about non-translated strings.
So if you have configuration strings (i.e no translation needed), create a separate XMl (like config.xml) and let only your translated strings on your localization folders.

Having different logo and app name depending on the Language (Android developer / multilingual App)

Is there anyway to define a logo and the app name depending on the language of the user?
All of my texts are set on strings for this purpose, but my app's name must be different for each language, so must be the logo.
Thank you.
Best Regards.
Take a look here:
http://developer.android.com/guide/topics/resources/localization.html
That is, use a string also for your app name referenced in the Manifest file, then create different folders:
res/values/strings.xml
res/values-fr/strings.xml
res/values-ja/strings.xml
Same applies to drawables:
res/drawable/strings.xml
res/drawable-fr/strings.xml
res/drawable-ja/strings.xml
And in general every resource located in res.
Here you can find more informations about available localization codes.

Android Multilanguage support

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/

How can I have more languages in an android app?

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.

Categories

Resources