|
|
Warning!It seems that you are using an anti-advertisement software like AdBlock. CoolSoft can exists thanks to a few banners and no popups. Thanks for your help. |
![]() |
Reply to comment
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: gettextThen 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.


