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 22.214.171.124 release ready!
Updated 29 September 2017
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
Keep coding and keep sharing 🙂
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.