Symfony i18n 字段和管理生成器

发布于 2024-12-17 18:09:55 字数 1232 浏览 1 评论 0原文

我使用 symfony 1.4.15 与主义。我有模块,有两个 i18n 字段。所以在我的形式课上我做了:

 $this->languages = sfConfig::get('app_cultures_enabled');
      $langs = array_keys($this->languages);

      $this->embedI18n($langs);

        foreach($this->languages as $lang => $label)
            {   
                $this->widgetSchema[$lang]['name'] = new sfWidgetFormTextarea(array(), array('cols'=>40,'rows'=>2));
                $this->widgetSchema[$lang]['description'] = new sfWidgetFormTextarea(array(), array('cols'=>80,'rows'=>5));
            }

而且它工作完美! 但我的表单中有很多字段,所以我需要在表单中创建一些“组”。所以我在我的 generator.yml 中进行下一步:

config:
      form:
        display:
          Main info:[active,position,сoverage_id,basis_id,durability_id,comfort_id,weight_coating,thickness_coating,height_of_pile,segment_id,width_rolls_one,width_rolls_two,width_rolls_three,standart_width_rolls,max_width_rolls,min_width_rolls]
          Price: [price,margin_on_roll,margin_on_cutting,special_discount,discount_for_residues]
          Market: [certificate]

并且我无法显示两个 i18n 字段“名称”和“描述”。我尝试 市场:[name_i18n] 和 name_i18n_uk 等等。那么是否可以制作?如果没有,还有其他方法可以以表格形式进行分组吗?

谢谢你!

I use symfony 1.4.15 with doctrine. I have module and there are two i18n field. So in my form class I make:

 $this->languages = sfConfig::get('app_cultures_enabled');
      $langs = array_keys($this->languages);

      $this->embedI18n($langs);

        foreach($this->languages as $lang => $label)
            {   
                $this->widgetSchema[$lang]['name'] = new sfWidgetFormTextarea(array(), array('cols'=>40,'rows'=>2));
                $this->widgetSchema[$lang]['description'] = new sfWidgetFormTextarea(array(), array('cols'=>80,'rows'=>5));
            }

And it is work perfect!
But I have many fields in my form, so I need to make some "groups" in my form. So I make next in my generator.yml:

config:
      form:
        display:
          Main info:[active,position,сoverage_id,basis_id,durability_id,comfort_id,weight_coating,thickness_coating,height_of_pile,segment_id,width_rolls_one,width_rolls_two,width_rolls_three,standart_width_rolls,max_width_rolls,min_width_rolls]
          Price: [price,margin_on_roll,margin_on_cutting,special_discount,discount_for_residues]
          Market: [certificate]

And I can not display two i18n field "name" and "description". I try
Market: [name_i18n] and name_i18n_uk and many other. So is is to possible to make?If not are there other way to group filed in form?

Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦途 2024-12-24 18:09:55

你可以在生成器中做这样的事情:

form:
  display:
    Market: [certificate, pt, en, es, ...]

What you can do is something like this in the generator:

form:
  display:
    Market: [certificate, pt, en, es, ...]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文