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 content ? Any experience ?


Go to End
Reply


9 Posts   1761 Views

Avatar
rob.s

Community Member, 78 Posts

16 November 2010 at 5:19am

Edited: 01/12/2010 10:49pm

Hi folks,

we have a customer request, building a website with english and arabic (multilingual) content.
Are there any existing expreriences ?

KInd regards,

Robert

Edit: solved
i had to put

i18n::$common_locales['ar_SA'] = array('Arabic');


in my _config.php

Avatar
dompie

Community Member, 88 Posts

18 November 2010 at 4:58am

Yes, we have build a site that was meant to be used in arabic language (and sooner or later will be). Although it is possible, there are some inconsistencies in the backend.
1) you will have to write manual checks for switching reading direction. this will be dependend on the logged in user settings. this works good in many situations (tinymce), but somehow it doesn't work an all fields.
2) its not possible to switch directionality for every item in the admin UI. Serveral field descriptions are displayed at the top left corner of a text input field, although writing inside this textbox works RTL. you will have to make some tradeoffs according work amount <-> complete arabic UI

At frontend level everything (except metadata) can be achieved by css files, that can be comfortably loaded according to active language. Metadata stuff is a matter of template design, this works well if you know how to use translatable and i18n extensions.

Avatar
rob.s

Community Member, 78 Posts

18 November 2010 at 5:04am

Hi Dompie,

thanks a lot for your opinion/experience.
But the backend/cms is planned to stay in english.
I have no idea, if an "arabic content editor" needs a RTL backend/cms ....

Hmmm.....

Avatar
dompie

Community Member, 88 Posts

18 November 2010 at 5:15am

In most cases it's sufficient you have textareas in RTL mode (that's what we did in the end).

Avatar
rob.s

Community Member, 78 Posts

1 December 2010 at 10:19pm

Edited: 01/12/2010 10:20pm

Hi,

i set up a dev environment and i do not get arabic (ar_SA) inside the translation tab ?????

Translatable::set_allowed_locales( array('de_DE', 'en_US', 'ar_SA' ) );

If i use 'he_IL' (hebrew) or 'fr_FR' (french) everythings works as expected. But NOT 'ar_SA' (arabic - saudi arabia).
The arabic lang is missing in the "language" pulldown on the left area of cms AND it is missing inside the translation tab of a page...

Any ideas ?

Kind regards, Robert

Avatar
dompie

Community Member, 88 Posts

2 December 2010 at 12:51am

Did you also set i18n? Don't know if this may have any effect, but I always used them together and SiteTree also (somehow) uses i18n.

// Set the site locale and allowed languages
i18n::set_locale('en_US');
$allowed_locales = array(
   'de_DE' => array('German', 'Deutsch'),
   'en_US' => array('English', 'English'),
   'ar_EG' => array('Arabic', 'العربية')
);
i18n::$common_locales = $allowed_locales;

// Make Pages translateable into other languages
Translatable::set_default_locale('en_US');
Translatable::set_allowed_locales(array('en_US', 'de_DE', 'ar_EG'));

Avatar
rob.s

Community Member, 78 Posts

2 December 2010 at 12:54am

Ahh, sorry,

in the meantime i figured it out but i edited my first post instead of the latest one.
But thx.

For testing reasons, is there a quick solution to switch the form fields and tinyMCE (inside cms) to RTL mode ?

Thanks in advance,
Rob

Avatar
dompie

Community Member, 88 Posts

2 December 2010 at 1:05am

Yes, it took me a while to figure this one out. Probably not the best solution, but it works. I've put it in the _config.php to make sure it's already set when SilverStripe outputs Backend stuff.

// Switch directionality for arabic sites in Backend Editors
if(stristr($_SERVER['REQUEST_URI'], 'ar_EG') !== FALSE || stristr($_SERVER['REQUEST_URI'], 'ar-')){
   HtmlEditorConfig::get('cms')->setOption('directionality', 'rtl');
}

Go to Top