Re: Localizing autherror and loginerror
why not translate these in beforeRender ? :) HTH, -- Marcin Domanski http://kabturek.info On Fri, Sep 12, 2008 at 8:28 AM, David C. Zentgraf <[EMAIL PROTECTED]> wrote: > > I had the same problem a while back, search the group for it. > The problem is that the first time a translation is done, i.e. the > __() function is used, the language is locked and cannot be changed > anymore for the rest of the page execution. (Actually, rightly so, > otherwise you might get half your page in English and the other half > in German.) > > Point being, if you want to change the language, make that the very > first thing you do in your app. > > Fröhliches Backen! > > On 12 Sep 2008, at 15:01, Braindead wrote: > >> >> Hi guys, >> >> after spending some more time I solved my problem with authError and >> loginError messages of the Auth component only displaying in the >> default language. >> Just in case somebody has the same problem I post the solution. :-) >> >> This is my app_controller.php file where only the L10n part and the >> messages are of interest: >> >> >> uses('L10n'); >> >> class AppController extends Controller { >> var $components = array('Auth'); >> >> function beforeFilter() { >> $this->L10n = new L10n(); >> $this->L10n->get($this->Session->read('Config.language')); >> >> >> if (isset($this->Auth)) { >> $this->Auth->fields = array('username' => 'email', >> 'password' => >> 'password'); >> $this->Auth->userScope = array('activated' => 1); >> $this->Auth->loginAction = array('controller' => >> 'users', 'action' >> => 'login'); >> $this->Auth->loginRedirect = array('controller' => >> 'pages', >> 'action' => 'display', 'home'); >> $this->Auth->logoutRedirect = array('controller' => >> 'users', >> 'action' => 'login', 'admin' => false); >> $this->Auth->loginError = __('auth_loginerror', true); >> $this->Auth->authError = __('auth_autherror', true); >> $this->Auth->autoRedirect = true; >> $this->Auth->authorize = 'controller'; >> } >> >> } >> >> function isAuthorized() { >> return true; >> } >> } >> > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Localizing autherror and loginerror
I had the same problem a while back, search the group for it. The problem is that the first time a translation is done, i.e. the __() function is used, the language is locked and cannot be changed anymore for the rest of the page execution. (Actually, rightly so, otherwise you might get half your page in English and the other half in German.) Point being, if you want to change the language, make that the very first thing you do in your app. Fröhliches Backen! On 12 Sep 2008, at 15:01, Braindead wrote: > > Hi guys, > > after spending some more time I solved my problem with authError and > loginError messages of the Auth component only displaying in the > default language. > Just in case somebody has the same problem I post the solution. :-) > > This is my app_controller.php file where only the L10n part and the > messages are of interest: > > > uses('L10n'); > > class AppController extends Controller { > var $components = array('Auth'); > > function beforeFilter() { > $this->L10n = new L10n(); > $this->L10n->get($this->Session->read('Config.language')); > > > if (isset($this->Auth)) { > $this->Auth->fields = array('username' => 'email', > 'password' => > 'password'); > $this->Auth->userScope = array('activated' => 1); > $this->Auth->loginAction = array('controller' => > 'users', 'action' > => 'login'); > $this->Auth->loginRedirect = array('controller' => > 'pages', > 'action' => 'display', 'home'); > $this->Auth->logoutRedirect = array('controller' => > 'users', > 'action' => 'login', 'admin' => false); > $this->Auth->loginError = __('auth_loginerror', true); > $this->Auth->authError = __('auth_autherror', true); > $this->Auth->autoRedirect = true; > $this->Auth->authorize = 'controller'; > } > > } > > function isAuthorized() { > return true; > } > } > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Localizing autherror and loginerror
Hi guys, after spending some more time I solved my problem with authError and loginError messages of the Auth component only displaying in the default language. Just in case somebody has the same problem I post the solution. :-) This is my app_controller.php file where only the L10n part and the messages are of interest: uses('L10n'); class AppController extends Controller { var $components = array('Auth'); function beforeFilter() { $this->L10n = new L10n(); $this->L10n->get($this->Session->read('Config.language')); if (isset($this->Auth)) { $this->Auth->fields = array('username' => 'email', 'password' => 'password'); $this->Auth->userScope = array('activated' => 1); $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login'); $this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'display', 'home'); $this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login', 'admin' => false); $this->Auth->loginError = __('auth_loginerror', true); $this->Auth->authError = __('auth_autherror', true); $this->Auth->autoRedirect = true; $this->Auth->authorize = 'controller'; } } function isAuthorized() { return true; } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Localizing autherror and loginerror
Hi guys, I'm currently localizing my application in English and German. Everything works as expected. Except the authError and loginError messages of the Auth component. I'm trying to set these messages in the app_controller beforeFilter event. But the messages are always shown in German (default language). This is my beforeFilter code (excerpt): function beforeFilter() { if (isset($this->Auth)) { $this->Auth->fields = array('username' => 'email', 'password' => 'password'); $this->Auth->userScope = array('activated' => 1); $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login'); $this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'display', 'home'); $this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login', 'admin' => false); $this->Auth->loginError = __('auth_loginerror', true); $this->Auth->authError = __('auth_autherror', true); $this->Auth->autoRedirect = true; $this->Auth->authorize = 'controller'; } } Can anybody help me to solve the problem? Thanks, Brain --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---