zoghal / cakephp-MultiTranslateBehavior

extended Cakephp 2.1 TranslateBehavior for support save/edit/validate of Multi Language in Forms
19 stars 11 forks source link

Behavior mess up template locale #8

Closed hugofcampos closed 10 years ago

hugofcampos commented 10 years ago

My site is localized in english and br-portuguese. When MultiTranslateBehavior is set, the templte looses its default locale.

Ex: before implementing MTB, my admin section was localized (menus, columns, etc). So, it was possible to see it in pt-br. after, setting MTB to pt-br and en, I can only see admin section in english.

I solved this putting this code in afterFind callback in every Model I have:

$this->setLocale(Configure::read('Config.language'));

I could not find a way to change it in MTB. Help me and ai can pull request this change!

zoghal commented 10 years ago

you must set in AppModel or Other

  // Option 1) just define the property directly
    public $locale = 'en_us';

help => Example B : http://book.cakephp.org/2.0/en/core-libraries/behaviors/translate.html#saving-in-another-language : http://book.cakephp.org/2.0/en/core-libraries/behaviors/translate.html#saving-in-another-language