RTL support Android multilanguage

Android RTL Support (Right to Left) Multi language App

Android have RTL support for multi language app. 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.

In this Android Tutorial, You will be learn How to make an App which do support English and Arabic Languages. If user will choose English language the App alignment will be Left to Right. If he/she chooses Arabic Then the App alignment will be Right To Left. You have to use Android Shared Preferences to store User Language Choice so that the app retains whatever Language we’ve selected even after leaving the app and coming back again. So lets begin this exciting tutorial on Android RTL Support for Multi Language App.




Android RTL Support Multi Language

Login & Download source code

download-code350-100

android course

 

1) Store User’s Language Choice
2) Set App Local Language
3) Add RTL Support on Layout

Store User’s Language Preference

First thing you need to do is create a share preference to store language selection. Now add two button for language on layout for example I added two button name as English and Arabic. Now on button click listener store value in share preference.

Set App Local

Now Create a folder name as value-ar (ar for arabic ) inside res folder . You can create value folder for other language too but remember to use initial letter on each value folder. Please check language support link. Copy string.xml file from default value folder and paste it inside this new folder. Now just covert the value of each string into corresponding language but don’t change the string id name. The string id name must be same otherwise system will displace default language only. for example-

Once you convert all the string value into another language then its time to set app local using java code. create on function on App launcher activity so that way whenever the app start it will get language preference from Share preference and will set app local on each launch. You need to pass language initial to this function. for example english – “en”, arabic – “ar”,french -“fr” etc.

Add RTL Support on Layout

Till so far you did all the task for language conversion only. Now you need to add Right to Left support on app that means text gravity will be right, navigation drawer will be on right side etc. first add the supportrtl =true on androidmanifest file.

Now on all layout filed change all the left with start and right with end. So when app local will change the android OS auto change the layout display too. to get more details about android multi language support see official link.

If you want more specific design change when user change the language then create another layout folder name as language-(init. letter of language). Please see below structure.

Remember Toolbar title name won’t change after user change the language. To solve this problem you need to set toolbar title string name from activity.

If you have any other question you can ask me.

android course

Do you want payment gateway integration?

Instamojo Payment Gateway
How to Integrate Paytm Payment gateway

Posted in andorid and tagged , , , , , .

kamal bunkar

I Am Post Graduation (M.Tech. C.S.E) from VNIT, Nagpur. I Have Published Two Research Paper On International Journal. My Apps on Google Play Store- Sanyukt Parivar(Mp Police ), NOTOtag- Digital Chhindwara, The Tubby-VoiceRecognizer & More.
Contact me at kamal.bunkar@blueappsoftware.in

Leave a Reply

Your email address will not be published. Required fields are marked *