开发者

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?开发者_如何学JAVA Thank you!


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 :

  • http://www.symfony-project.org/gentle-introduction/1_4/en/13-I18n-and-L10n#chapter_13_text_information_in_the_database
  • http://www.symfony-project.org/jobeet/1_4/Doctrine/en/19
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜