Jump to:

10990 Posts in 2727 Topics by 1818 members

All other Modules

SilverStripe Forums » All other Modules » SS 2.3.5 breaks translatable?

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 823 Views
  • theoldlr
    Avatar
    Community Member
    103 Posts

    SS 2.3.5 breaks translatable? Link to this post

    Hi all,

    I have a site setup with translations on SS 2.3.3 that is working as it should. I used the exact same code from mysite/_config.php for a new 2.3.5 and now it is not working. In the CMS the language dropdown is present with the default language only. When on the translations tab of a Page the New Translation Dropdown is empty. Here is the portion of code from _config.php regarding translatable:

    Object::add_extension('SiteTree', 'Translatable');
    Translatable::set_default_locale('en_US');

    //global $allowed_locales;
    $allowed_locales = array(
    'en_US',
    'pt_BR',
    'es_CL'
    );

    Translatable::set_allowed_locales($allowed_locales);

    Thanks!

  • Juanitou
    Avatar
    Community Member
    323 Posts

    Re: SS 2.3.5 breaks translatable? Link to this post

    Hi!

    In my setup, which is working, I don’t use Translatable::set_allowed_locales($allowed_locales); but i18n::$common_locales = $allowed_locales;. I know that it doesn’t mean the same thing, but maybe it can help.

    You should look in CMS code where the list New Translation is coming from, there’s maybe a bug somewhere.

    Regards,
    Juan

  • theoldlr
    Avatar
    Community Member
    103 Posts

    Re: SS 2.3.5 breaks translatable? Link to this post

    Thanks Juan!

    Your method worked... though I cannot explain why my previous method worked before and not now.

    For anyone else that might be having the same problem here is the code that is working for me on SS 2.3.5:

    Object::add_extension('SiteTree', 'Translatable');
    Translatable::set_default_locale('en_US');

    $allowed_locales = array(
    'en_US' => array('English', 'English'),
    'pt_BR' => array('Portuguese', 'Português'),
    'es_CL' => array('Spanish', 'Español')
    );

    i18n::$common_locales = $allowed_locales;

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