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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Arabic and other RTL languages (Frontend Templates)


Go to End


5 Posts   4276 Views

Avatar
Double-A-Ron

Community Member, 607 Posts

22 January 2010 at 2:41pm

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?

Avatar
sajok

Community Member, 82 Posts

26 January 2010 at 2:16am

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

Avatar
Double-A-Ron

Community Member, 607 Posts

26 January 2010 at 8:23am

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

Avatar
sajok

Community Member, 82 Posts

26 January 2010 at 12:57pm

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

?!

Said

Avatar
Double-A-Ron

Community Member, 607 Posts

26 January 2010 at 1:39pm

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.