Using Multi language localization (Arabic, English) - android

Using Multi language(Arabic,English) in Application.
If we set Arabic language as language in the app.For Numbers,Text view showing Arabic number.I want English numbers not Arabic number even if we selected English language.how to show number in English even if language is in Arabic?

Ok
Just Try to put Your string and Numbers In formatted String and use this
something like this
<string name="welcome_messages">Hello, %1$s! You have %2$d new messages.</string>
and then
<resources xmlns:tools="schemas.android.com/tools"; tools:locale="en">

By default numbers are displayed in English only, unless you format the string, but it is not a good practice to use digits in English while using language that supports RTL specification. Please refer this: https://developer.android.com/training/basics/supporting-devices/languages.html#FormatNumbers
It seems that you are changing language from device setting, please try changing language within the app, changing language from device setting will display numbers in that language.

Related

Greek language is not used in Android

I want to support the greek language.
I translated my string.xml into the greek language.
Then I put the greek string.xml it into a folder called: res/values-gr besides the normal res/values.
So my folder looks like this: res/values-gr/string.xml
Then I set my phone language to greek.
However, the app still displays english only.
Has anybody an idea what I am doing wrong?
In your case you need to create a folder:
values-el for the Greek translation, or
values-el-rGR for the country-specific Greek translation.

Copy/paste dialog in android showing only english for both english and spanish layout language change

I am using English,Arabic,Farsi and spanish language layouts.
If I'm in English layout the dialog shows in English like copy/paste thats good.
When I change it to Spanish then also the dialog showing copy/paste.
Same for Arabic and Farsi both showing copy/paste dialog in Arabic.
How to change copy/paste dialog with multiple languages?
You dont need to have a lot of layouts to have different languages, just edit your Strings values into res - Strings , you can create more than one String for different texts, and then programatically with your layout you can change the language depending on the phone and people location
See this : https://developer.android.com/training/basics/supporting-devices/languages.html
ps: with the same string id, you can have more than one language, the phone will choose in which language it pulls the text from Strings.xml

How to provide Arabic Language support in Android Application

I have made an application in android but now I have to provide arabic language support. I have checked many of answers in stackoverflow but from any answer I didn't get correct answer.
To provide localization support for different languages, we need to add the language specific resources into separate folder. For eg:Inorder to provide layouts for Arabic language
we need to create a separate folder under res folder i.e.,res/layout-ar like this.
In order to access the current language via code we can get the current language by calling
Locale.getDefault().getDisplayLanguage();
for more information look into following links:
for localization :http://developer.android.com/guide/topics/resources/localization.html
for RTL layout mirroring (Arabic like languages):http://android-developers.blogspot.de/2013/03/native-rtl-support-in-android-42.html
Also you may need to use 'onConfigChange' to your 'AndroidManifest' file with option 'locale'
I am just a beginner but I have looked this question up and came up with this:
http://marketplace.eclipse.org/content/android-string-localization#.VG5A_PmUeSp
Eclipse provides string localization. However, when it translated the strings to Arabic, I had to double check the translation because Arabic has Feminism in Grammar and also some plural forms aren't that correct.
In AndroidManifest.xml:
SupportRtL
this will enable alignments of images and text to right in Arabic and left in English
Create two string resource layouts (one English, one Arabic)
string Resource
Add the same string with the same name in the two layouts but change the value of the arabic string in the (ar\strings.xml)
Same goes to each drawable item
(Also for reference I'll add how you can create a resource that ar or RL)
creating arabic resourse
Also either in the base activity to set the base local language
app = (MyApplication)getApplicationContext();
lang = Actions.setLocal(this);using the function:
function

Android: Regarding using different strings based on user choice

You can use strings in this way: " R.string.*" or in xml: "android:text=#strings/*" - right?
They all take their values out of a fixed file named strings where you put them all in right?
Let's say I have an app where there is the possibility to change language. Is there a way in which I can change that string file? Let's say have a strings file for English and strings for French or anything.. so i can still use the R.string.* and #string/* but I will get different values depends on the user choice?
The Developer's Guide on Localization covers this.
In short use the same string names, but have different locale folders, like:
res/values/strings.xml for the default language
res/values-fr/strings.xml for French
res/values-ja/strings.xml for Japanese
The OS will load the appropriate language for R.string.hello for you.

How to display Text in Different languages in a single list view [Android]

I need to display language selection Activity where I want to display List of supported Languages.
I want to display List of languages in the specific language either, English in English, French in French and Japanese in Japanese in one ListView.
I know how we can create multy language Application, using different strings.xml files.
But don't have any idea, on how to display ListView in multiple languages.
Thanks.
You can define all the listview strings in String.xml file Like
<string-array name="language_list">
<item>English</item>
<item>Française</item>
<item>日本語</item>
<item>Deutsch</item>
<item>Español</item>
<item>Português</item>
<item>Italiano</item>
<item>简体中国</item>
</string-array>
and then populate the array in your java file. using adapter display list for this array.
It's not that Android restricts you to use a specific language for a specific locale. You can define a language list in values/strings.xml, fill the ListView and change application locale accordingly (see this question: Changing Locale within the app itself).

Categories

Resources