The other day I got a support question on Related Posts for WordPress that said “My website is in Hebrew, your plugin does not support my language.” I have to admit, at first I had no clue what he ment by “does not support my language”. The plugins finds related posts based on the language your content is written in so how can it not support your language?
As I don’t speak Hebrew I decided to do a bit of reserach to see if I can find out what might cause this plugin conflict. Reading through the Wikipedia page I realized what in the plugin didn’t support Hebrew.
Modern Hebrew is written from right to left using the Hebrew alphabet, which is an abjad, or consonant-only script of 22 letters.
Hebrew is, like many other languages, a right-to-left language and my plugin was build and only tested in left-to-right languages.
Supporting right-to-left languages
Luckily it wasn’t that hard for me to add right-to-left support to my plugin once I found out how to do it. For me to add RTL support I had to change the value of certain CSS attributes from right to left and vice-versa.
You should change the following attributes:
text-align: left; becomes
text-align: right; and vice-versa.
Detecting right-to-left languages
WordPress comes with the function
is_rtl() which you can use to detect if the current language is a RTL language. Based on the result of that function you decide if you want to load a different CSS file, load an extra CSS file (like rtl.css) or like me change the inline style that’s being added to the page.
Does your plugin support RTL languages? And if so, how do you support it? I hope this helped you and please let me know if I missed something by leaving a comment below.