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

LoginForm and i18n::set_locale()?


Go to End


2 Posts   2291 Views

Avatar
a5s

Community Member, 1 Post

22 October 2009 at 9:05pm

Hi,

I've a multilanguage-site and I created a custom form

class MyLoginForm extends LoginForm ...

everything works fine (This forum was and is allways a good help!). Also if I have selected German, then when the form is displayed, it is allways set to english and i18n::get_locale() will allways output en_US. All other Pages are in German.

In page.php was "de_DE" set with:

i18n::set_locale($this->dataRecord->Locale);

Do anyone know why or where is it set to en_US? Did I anything wrong?

i18n::set_locale('de_DE');
works im my class MyLoginForm. But sometimes user select en_US.

How can I set language in my form? How can I access to the property $this->dataRecord->Locale out of my class MyLoginForm?

Thanks!

Avatar
Ingo

Forum Moderator, 801 Posts

2 November 2009 at 8:45am

Hm, how do you access your custom login form? Did you override the Security/login DIrector rule?

> Also if I have selected German, then when the form is displayed, it is allways set to english
So you've selected it by i18n::set_locale(), right? The user-specific settings in profile popup won't have any effect before logging in.