Jump to:

5542 Posts in 1739 Topics by 1225 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Custom login & translatable

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

Page: 1
Go to End
Author Topic: 807 Views
  • micschk
    Community Member
    19 Posts

    Custom login & translatable Link to this post

    I've build a multilanguage-site (NL & FR, using translatable) and I created a custom login form

    class CustomLoginForm extends MemberLoginForm

    Everything works fine, but when a visitor selects the French locale, the login-form part is always displayed in Dutch (NL). The header & footer are all in french, and even $Locale outputs 'fr_FR'

    In page.php Page_Controller::init():

    if($this->dataRecord->hasExtension('Translatable')) {
    // Set locale for PHP, dates etc;
    setlocale(LC_TIME, Translatable::get_current_locale() . ".UTF8");

    Even when I set the locale to French in _config.php, the form is still shown in Dutch;


    I ended up setting the locale again within the custom loginform file, which works (at least a preliminary fix);


    // Set locale again, for some reason the locale from page_controller isn't adhered to...

    class CustomLoginForm extends MemberLoginForm { ...

    Is this the way translations are supposed to work? Or have I done something wrong?

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.