Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Arabic and other RTL languages (Frontend Templates)


5 Posts   2795 Views


22 January 2010 at 2:41pm Community Member, 604 Posts

Hi guys,

I have a client who wishes to have a Translatable Arabic version of their 2.3.3 SS site.

Has anyone worked with a RTL translation? I assume that the template will need to change to allow for dynamic orientation of the text as per this article: (adding a dir="rtl" attribute to the HTML tag on the fly)

Other than that, I assume the process is the same as for a LTR language? But what about in terms of writing content in the CMS? Obviously writing translations in Arabic in the default LTR orientation is a-kin to me writing this post backwards?


26 January 2010 at 2:16am Community Member, 82 Posts

I'm currently working on a multilingual website with Arabic and French. I made Arabic as the default and created a ltr.css file which get loaded when the user switches to French pages. In the main stylesheet I set direction to rtl and text-align to justify. That works great for me. As for the tinyMCE is set to LTR by default, I changed the directionality option to RTL in mysite/code/page.php. That's however, is not the final solution because I'll have to change the directionality back to LTR when I want to translate a page to french.. it would be great if we can change the directionality otion in the admin CMS.



26 January 2010 at 8:23am Community Member, 604 Posts

Thanks sajok, at least I can notify the prospective customer that there is no easy way to switch bidi on the CMS side of things.

Just as a side to you, I am not sure how outdated the article I linked to is, but W3C specifically states that you should use the dedicated HTML attribute rather than CSS direction.

More on this here:



26 January 2010 at 12:57pm Community Member, 82 Posts

thank you for the link..I didn't know actually that dir attribute in <html> is better than the direction attribute in css. So in my case after doing some adjustements to my code, this if statement does the trick :

<% if Locale == ar_MA" %>
<html xmlns="" xml:lang="en" dir="rtl">
<% else %>
<html xmlns="" xml:lang="en" >
<% end_if %>

do you have any idea how I can change the default directionality option of TinyMCE depending on the current locale.. something like this : mysite/code/page.php

   public function getCMSFields() {
      $fields = parent::getCMSFields();
      if (locale=='ar_MA') {
      HtmlEditorConfig::get('cms')->setOption('directionality', 'rtl');
      return $fields;




26 January 2010 at 1:39pm Community Member, 604 Posts

Not sure, but looking at the docs for both HTMLEditorConfig(, and TinyMCE (, your code looks about right. There is a note on the HTMLEditorConfig doc page that says: "Note this functionality is likely to be changed in future releases."

There is also a TinyMCE Plugin that allows the user to toggle directionality using buttons., but that sounds like an unnecessary mouse click to me.

As far as Silverstripe is concerned, the last post here might be a better solution to what you have come up with here (if it is not working):

My client is not paying for this mod at present and I am under the pump on another project. So I'd be interested to know how you get on. As a non-Arabic speaker, I would also be interested to know if the interface layout of the CMS is ideal when the language is set to Arabic. I notice that navigation elements are still LTR.