Zend framework, gettext, poedit and human language in which key strings are written -


I am using a website Zend Framework and have decided to internationalize its content using the Gettext system. In my opinion I write string in French and at this moment only one file "en.mo" so that sentences can be translated into English. I would like to avoid maintaining a file "fr.mo", which will only really translate into a single sentence.

Tell Zend or Gettext that when locale "fr" or "fr_FR" there is no need to search for the translation file and the key string should be back now? Or maybe there is a reason to create "identity translation" file fr.mo?

Important quote of my code at this point:

My bootstrap extracts:

getApplication ( ) -> getOptions (); Zend_Locale :: SetDefault ('n'); // Fallback if the identity completely fails $ locale = new Zend_Locale (); If (! In_array ($ locale-> getLanguage (), explosion (',', $ config ['available_translations'])) {$ localale-> setLocale ('n'); // Requested language is not available => English Use} $ translate = New Zend_Translate (array ('adapter' => 'gettext', 'content' => APPLICATION_PATH. '/ .. / languages ​​/ gda -'. Locale-> find language (). $ '.', 'Local' => $ locale); $ translate-> setLocale ($ location); $ this-> bootstrap ('view'); $ this-> getResource ('view') -> getHelper ( 'Translation of') -> setTranslator (translation of $);}

The contents of:

 gda-en.mo gda-fr.mo  

Zend_Translate

Fluxin,

/ Code>, you'll need it:

  • gda.pot (in your case, in French) with all your msg-ids. with at least one translation (which will be almost empty)
  • ..)
  • gda-en.mo
  • Gda / some other translation files to generate
    • Gda-en.po gda-de.mo
    • ....
    • Gda-XX.po To generate>
    • The important fact is that:

      Your " Identification translation ", as you say it should be present, otherwise the Zend will complain about the fact that" fr "(your case) is not available

      In PEDET, a small translation into a single string Please, related *. Generate Mo file, save it and forget about it

      You will not need to update your gda-fr.po file anymore, and not an updated gda-fr.po file Will have to be revived

      P>

      The adapter will return the original, French, string because the gda-fr.mo

html for this

Comments