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.

All other Modules /

Discuss all other Modules here.

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

SS 2.3.5 breaks translatable?


Go to End


3 Posts   1209 Views

Avatar
theoldlr

Community Member, 103 Posts

3 February 2010 at 10:08am

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!

Avatar
Juanitou

Community Member, 323 Posts

3 February 2010 at 12:08pm

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

Avatar
theoldlr

Community Member, 103 Posts

5 February 2010 at 2:18am

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;