21278 Posts in 5728 Topics by 2599 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 333 Views |
-
[SOLVED] Translation of /Security

26 March 2012 at 7:00pm
I have a multi lingual site and everything works fine exept the translation of the login form.
I use SS 2.4.7 with the following config:
i18n::set_locale('de_DE');
Translatable::set_default_locale('de_DE');
Translatable::set_allowed_locales(
array(
'de_DE',
'fr_FR',
'it_IT',
'en_GB',
)
);
Object::add_extension('SiteTree', 'Translatable');
Object::add_extension('SiteConfig', 'Translatable');I need the users to be able to login on the front end, so I created a link to /Security/login. But whatever locale the site currently is, the login form is always displayed in german. Even if I add the locale to the link e.g. /Security/login?locale=en_EN the login form always is in german.
Is there a possibility to get Security translated as well? or am I just doing something wrong?Thank youvery much for your help...
-
Re: [SOLVED] Translation of /Security

3 April 2012 at 12:47pm
simon_w had a solution for this, thanks again!
Translatable loads the locale automatically, i18n doesn't. To get the page loaded in the correct locale, you have to add the following in you _config ():
if(!empty($_GET['locale'])) i18n::set_locale($_GET['locale']);
Security loads the content in a fake page. In that case you can check the ID to be <0.
Page_Controller.init():if ($this->ID < 0) {
if(!empty($_GET['locale'])) i18n::set_locale($_GET['locale']);
}It's not the perfect solution and I had to sub class Security and MemberLoginForm to rewrite all the links that didn't include the locale, but it works so far.
| 333 Views | ||
|
Page:
1
|
Go to Top |

