Search code examples
internationalizationsymfony1yaml

Symfony: i18n in generator.yml


Does anyone know if there's a possibility to use i18n in the generator.yml file like this:

generator:
  class: sfDoctrineGenerator
  param:
    ...
    config:
      edit:
        title: Editing Category xyz

Now I'd like to translate the title in my i18n files.


Solution

  • It should work out of the box. All the form labels are passed through translation function automatically.

    You need to enable i18n in your application and create translation files. Simple as that.

    Assuming you have a backend application, to enable i18n edit your apps/backend/settings.yml:

    all:
      .settings:
        i18n: true
    

    Generate translation catalog for language(s) you need:

    ./symfony i18n:extract --auto-save backend fr
    

    At the end you need to translate your messages. Simply edit generated apps/backend/i18n/fr/messages.xml.