Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RTL Languages support in android and resource qualifiers

I read this sentence " Android 2.3 added support for right-to-left (RTL) languages" and now I want to add RTL support to my app. But I do not know what is qualifiers to add to my layouts.

About res/values/strings.xml , I can named like this res/values-ar/strings.xml

I want to have different layout for RLT languages. I do not want to have just different strings , I also want different layout. What the layout folder name should look like ?

At this moment for the left to right languages it is named res/lauyots/main.xml but I do not know how to name it for RTL languages

Is this kind qualifier is present at all ?

like image 252
Lukap Avatar asked Sep 14 '11 16:09

Lukap


People also ask

What is RTL support in android?

If your app does support multiple language like english, hindi, arbic, urdu etc where some language script write in Right to Left Direction. So you have to add RTL support(Right to Left) on android app for wide range of users from different regions which truely requires the feature of Android Multi Language Support.

What is RTL support?

are RTL, meaning they are read right-to-left, instead of left-to-right. Typically in web applications supporting one of these languages, everything is reversed, meaning scroll bars, progress indicators, buttons etc.

How do I install RTL support on android?

Just go to Android Studio > Refactor > Add RTL support where possible… I would recommend you checking your app once after applying this change as you might not want all your Layouts/Views to be RTL. If you want to force any layout to LTR then just add android:layoutDirection="ltr" to that view.

What is LTR and RTL in android?

So when you setted an RTL script text to textview, text will start from right automatically. But if in RTL mode you set an LTR script text, textView's text will start left like below (Even if you replaced left/right to start/end).


2 Answers

You can find -ldrtl and -ldltr qualifiers in Providing resources

res/layout-ldltr/ (Left to Right, default value)
res/layout-ldrtl/ (Right to Left)
like image 102
A. Ferrand Avatar answered Oct 25 '22 21:10

A. Ferrand


@Silwek is right. This is his answer, I am merely putting it here because my answer has been marked as answered.

res/layout-ldltr/ (Left to Right, default value)
res/layout-ldrtl/ (Right to Left)

Old Answer

Check Localization and Multiple Screen Support, they give you idea about resource folders and qualifiers.

You can use locale specific resources and layout like this:

For language specific resources:

res/values/strings.xml
res/values-fr/strings.xml (French)
res/values-ja/strings.xml (Japanese)

For language specific layouts:

res/layout-fr/main.xml
res/layout-ar/main.xml
like image 23
Ragunath Jawahar Avatar answered Oct 25 '22 19:10

Ragunath Jawahar