Gokul.T
Gokul.T

Reputation: 75

Android Localization for resources arabic language

I want to localize an image Arabic language? How should I accomplish this task?

I have followed Localization and drawables but no luck.

Upvotes: 2

Views: 4817

Answers (3)

Ahmad Aghazadeh
Ahmad Aghazadeh

Reputation: 17131

You can add new android resource folder

enter image description here

enter image description here

enter image description here

Upvotes: 1

Bundeeteddee
Bundeeteddee

Reputation: 724

Don't forget that once you've added your strings.xml into the resource file for arabic, ensure your layout is ready for RTL support.

In your manifest file:

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

And in all your layout files, ensure you added the left/right and start/end combo. From Google Blog:

Change all of your app's "left/right" layout properties to new "start/end" equivalents.

If you are targeting your app to Android 4.2 (the app's targetSdkVersion or minSdkVersion is 17 or higher), then you should use “start” and “end” instead of “left” and “right”. For example, android:paddingLeft should become android:paddingStart.

If you want your app to work with versions earlier than Android 4.2 (the app's targetSdkVersion or minSdkVersion is 16 or less), then you should add “start” and end” in addition to “left” and “right”. For example, you’d use both android:paddingLeft and android:paddingStart.

Once you are done, its quite easy to test it out. Either change your language to arabic, or in the phone's Developer Option, you can force it to show RTL in layout.

Upvotes: 1

Shabbir Dhangot
Shabbir Dhangot

Reputation: 9121

localization of drawable-resources is same as string-resources. You need to create drawable-ar folder and put image into that folder.

Or if your image in any folder like drawable-mdpi then drawable-ar-mdpi.

Read detail documentation here.

Upvotes: 2

Related Questions