Attenzione!

Sembra che un programma di rimozione della pubblicità come AdBlock sia attivo.
Anche io uso AdBlock, ma preferisco bloccare solo la pubblicita fastidiosa ed invasiva.

CoolSoft si accontenta di un paio di banner non fastidiosi e nessun popup.
Per favore aggiungi CoolSoft alla tua lista delle esclusioni, come mostrato nell'immagine a fianco.

Grazie per l'aiuto.

Configure Symfony to use gettext translation files

Once finished my Symfony application, I'm now facing with the translation task.

Symfony comes with XLIFF as default translation provider; XLIFF is a good format, which manages correctly UTF-8 charsets, but its editor support is poor.
I tried some editors, most of them in Java, but none satisfied me (all of them are joung and primitives).

gettext() is a stable and well-known choice and, most of all, it has a great Eclipse integrated plugin.
Ok, let's try to configure Symfony to use gettext as translation provider.

Documentation on this argument is a bit confused and does not target version 1.2 of the framework, so this is my contribute.

Enable I18N framework in settings.yml:

#apps/<appName>/config/settings.yml
all:
  .settings:
    charset:                utf-8
    i18n:                   on
    standard_helpers:       [ ...your helpers..., I18N]

Now in documentation you'll read to create a i18n.yml file, and you'll also read that this is deprecated (with no further details on how to proceed).
The right way is to add this config params to your factories.yml file:

#apps/<appName>/config/factories.yml
all:
  i18n:
    class: sfI18N
    param:
      default_culture:  en_US
      source:           gettext

Then create language folders under apps/<appName>/:

 apps/<appName>/i18n/<lang>

Now all the i18n related Symfony tasks should use gettext() as translation provider, including i18n:extract. 

You're done, now choose your favorite .po file editor and start translate your application.

My suggestions are: Poedit as standalone editor and gted as Eclipse plugin.

Comments

Problem with your description

Hi!

Thanks for this information, it may be usefull to specify that the i18n config should be added in factories.yml

Thanks
Mick

You're right, I'll add

You're right, I'll add filenames to code snippets right now!

Thanks
Claudio

Great!

This is great!  Like you said the free editors for gettext are much better and simpler than any I have found for xliff.