Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
In this blog, we will learn on how to identify RTL language in your android application.
The reason for writing this blog is pretty clear from the title itself and there are many ways to get this done.
But while working on including Farsi language in my application I ran into some problem and I needed to fix this problem, the reason was pretty straight that the orientation was supposed to be RTL, but with all the approaches I knew I was not getting the orientation to be RTL.
When I checked all the approaches, they were in some manner getting the orientation from the locale, which in turn was getting the direction from the Character class, and thus for some reason, the RTL flag for Farsi was not coming as it should be.
Then after pondering upon the issue, I got to know that the directionality returned for Farsi is a bit different than the Default RTL languages.
So, when I looked up in the Character class, I found that there are actually two flags that are returned for RTL languages viz. DIRECTIONALITY_RIGHT_TO_LEFT and DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC. If you will look just below this line then you will see some other flags also with the RIGHT_TO_LEFT indicators in them, but I never got them in return values.
Now it was all clear and all I needed to include this also in my code as RTL identifier.
Let’s see what I followed :
function is RTL()
using this function in the code
That’s all.
Keep coding and keep sharing 🙂
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Great Product, Great Team, and Great Support Service. And if you want to add more features to the product, they can submit any idea that comes to your mind. They really care about their clients and we are really happy and honored to deal with Webkul.
Osama
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.