Jump to:

23355 Posts in 17734 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » Arabic content ? Any experience ?

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 2
Go to End
Author Topic: 1670 Views
  • rob.s
    Avatar
    Community Member
    78 Posts

    Arabic content ? Any experience ? Link to this post

    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

  • dompie
    Avatar
    Community Member
    88 Posts

    Re: Arabic content ? Any experience ? Link to this post

    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.

  • rob.s
    Avatar
    Community Member
    78 Posts

    Re: Arabic content ? Any experience ? Link to this post

    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.....

  • dompie
    Avatar
    Community Member
    88 Posts

    Re: Arabic content ? Any experience ? Link to this post

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

  • rob.s
    Avatar
    Community Member
    78 Posts

    Re: Arabic content ? Any experience ? Link to this post

    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

  • dompie
    Avatar
    Community Member
    88 Posts

    Re: Arabic content ? Any experience ? Link to this post

    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'));

  • rob.s
    Avatar
    Community Member
    78 Posts

    Re: Arabic content ? Any experience ? Link to this post

    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

  • dompie
    Avatar
    Community Member
    88 Posts

    Re: Arabic content ? Any experience ? Link to this post

    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');
    }

    1670 Views
Page: 1 2
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.