Android RTL locales. How to mirror only when locale is supported

androidlocaleright-to-left

I have an app that supports Hebrew and declares in the manifest its support for RTL locales. However, there are other RTL locales that I do not support and would like my Views not to be mirrored when these locales are set. For example, I don't want my app's Views to be swapped from right to left when in the Arabic locale, since I don't support Arabic and therefore text will show in English.

Best Answer

I guess the best way is to make android:supportsRtl value to be selected according to the language. To do that see below:

AndroidManifest.xml

 <application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme"
    android:supportsRtl="@string/is_hebrew" >...</application>

Then in values/strings.xml add:

<string name="is_hebrew">false</string>

And with values-he/strings.xml add:

<string name="is_hebrew">true</string>