Jump to:

23453 Posts in 18904 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Arabic and other RTL languages (Frontend Templates)

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

Page: 1
Go to End
Author Topic: 2734 Views
  • Double-A-Ron
    Avatar
    Community Member
    604 Posts

    Arabic and other RTL languages (Frontend Templates) Link to this post

    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: http://www.w3.org/International/tutorials/bidi-xhtml/ (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?

  • sajok
    Avatar
    Community Member
    82 Posts

    Re: Arabic and other RTL languages (Frontend Templates) Link to this post

    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.

    Said

  • Double-A-Ron
    Avatar
    Community Member
    604 Posts

    Re: Arabic and other RTL languages (Frontend Templates) Link to this post

    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: http://www.w3.org/International/questions/qa-bidi-css-markup

    Aaron

  • sajok
    Avatar
    Community Member
    82 Posts

    Re: Arabic and other RTL languages (Frontend Templates) Link to this post

    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="http://www.w3.org/1999/xhtml" lang="en" dir="rtl">
    <% else %>
    <html xmlns="http://www.w3.org/1999/xhtml" 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;
        }
    }

    ?!

    Said

  • Double-A-Ron
    Avatar
    Community Member
    604 Posts

    Re: Arabic and other RTL languages (Frontend Templates) Link to this post

    Not sure, but looking at the docs for both HTMLEditorConfig(http://doc.silverstripe.org/doku.php?id=htmleditorconfig), and TinyMCE (http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/directionality), 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. http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality, 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): http://www.silverstripe.org/general-questions/show/268901#post268901

    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.

    2734 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.