开发者

Symfony 1.4 doctrine admin generator and i18n fields

I have this pretty trivial model:

Category:
  columns:
    id: { type: integer }
    name: { type: string(50) }
    description: { type: text }
  actAs:
    I18n:
      fields: [name, description]

I use admin generator to create CRUD interface for this model and the problem is that I can't 开发者_JAVA百科find the way to show i18n fields (name and description). When I try explicitly listing them in generator.yml I get the error 'Widget "name" does not exist.'.

Is there any build in way to do this or I have to create my own custom widgets, or else?

Thanks!


I finally found the answer well 'hidden' into Symfony own documentation :) (Practical symfony - Day 19: Internationalization and Localization)

The key part is to embed i18n to the form using:

$this->embedI18n($cultures);

where $cultures is array with required cultures. For example:

$cultures = array('en', 'fr', 'ru');

This was showstopper for me and hard to find straightforward explanation, so I hope it will save some time for other Symfony users.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜