0
votes

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 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!

1

1 Answers

3
votes

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.