Development

HowToUseI18NWithGettext

You must first sign up to be able to contribute.

Version 5 (modified by endor, 9 years ago)
--

How to use I18N with gettext

  • set source in your i18n.yml file to gettext:
    all:
      default_culture: en
      source: gettext
    
  • enabled i18n in settings.yml
    all:
      .settings:
        i18n: on
    
  • place the I18nSaverFilter class from #253 in your <appdir>/lib directory
  • active the filter in <appdir>/config/filters.yml:
    myI18nSaverFilter:
      class: I18nSaverFilter
    
  • create a directory in <appdir>/i18n for each language you want to translate to
  • create message.po, message.mo in this directory i.e.
    cd de
    touch messages.po messages.mo
    
  • make them writeable by the webserver (the I18nSaverFilter will write untranslated string to this files while you browse your website):
    chmod 777 messages.po messages.mo
    
  • translate the .po files (i.e. with http://www.poedit.net/, but there are loads of other tools)
  • update messages.mo files with
    msgfmt messages.po
    
  • i18n.yml is deprecated. please use factories.yml.