Search code examples
symfony1sfguardsfdoctrineguardsymfony-1.4

sfGuardGroup and i18n


I use symfony 1.4.11 with Doctrine. I have site, and it has 3 languages. I use sfDoctrineGuardPlugin 4.0.1 , and I have 3 groups of users. In site I show to each user his group, and I need it show to each user in current language. So I add to sfGuardGroup field i18n behavior, but I do not now, is it good idea? Is there another solution for this? Thank you!


Solution

  • An answer depends on how you deal actual with i18n, i mostly prefer messages.xml files !

    Anyway i would expect sth like this :

       /* actions.class.php */
       function executeBla($request){
           $this->myUser = Doctrine_Core::getTable("SfGuardUser")->find(ID);
       }
    

       /* blaSuccess.php */
       use_helper("I18N");
    
       // Users Groups translated
       foreach($myUser->getGroupNames() as $group){
           echo __($group);
       }
    

    You'll find sufficient information in symfony's docu :