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.

Form Questions /

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

[SOLVED] Login form translation only partially working


Go to End


3 Posts   1310 Views

Avatar
Bob Martin

Community Member, 5 Posts

11 November 2011 at 3:33am

hi.

I have some pages in my CMS that are secured so you have to log in to see them. Example: http://www.bangkran.de/praesentationen
The language of my page is german. However, the login form translates not everthing of its content. As you can see, the "That page is secured. Enter your credentials..." part is still english. This is weired since there is a translation for it available in the sapphire/lang/de_DE.php file.

$lang['de_DE']['Security']['NOTEPAGESECURED'] = 'Diese Seite ist geschützt. Bitte melden Sie sich an und Sie werden sofort weitergeleitet.';

my _config.php

Translatable::set_default_locale('de_DE');
Translatable::set_allowed_locales(array('de_DE','en_US','ru_RU'));

Object::add_extension('SiteTree', 'Translatable');
Object::add_extension('SiteConfig', 'Translatable');

What's the problem / my mistake ?

Thank you in advance
Martin

Avatar
Devlin

Community Member, 344 Posts

12 November 2011 at 2:37am

Edited: 12/11/2011 2:43am

Translatable is for database content. Use i18n for templates and forms.

i18n::set_default_lang("de_DE");
i18n::set_locale('de_DE');

http://doc.silverstripe.org/sapphire/en/topics/i18n
http://doc.silverstripe.org/sapphire/en/topics/translation

Avatar
Bob Martin

Community Member, 5 Posts

12 November 2011 at 4:51am

i18n::set_default_lang() is deprecated, it calls Translatable::set_default_lang() ;)
But i18n::set_default_locale() did the trick, thank you !