I'm writing a website using ZendFramework and decided to use the gettext system to internationalize its content. In my views I write string in french and provide a this moment only one file "en.mo" to translate sentences to english. I would like to avoid to maintain a file "fr.mo" which would only translate a sentence to the exact same sentence.
Is there a way to tell Zend or gettext that when the locale is "fr" or "fr_FR" then there is no need to search for a translation file and the key string must be just returned as is ? Or maybe there is a reason to create the "identity translation" file fr.mo ?
Key-quotes of my code at this point :
Extract of my bootstrap:
protected function _initTranslations() { $config = $this->getApplication()->getOptions(); Zend_Locale::setDefault('en'); // fallback if detection fails completely $locale = new Zend_Locale(); if ( !in_array($locale->getLanguage(), explode(',',$config['available_translations']))) { $locale->setLocale('en'); // requested language is not available => use english } $translate = new Zend_Translate(array( 'adapter' => 'gettext', 'content' => APPLICATION_PATH.'/../languages/gda-'.$locale->getLanguage().'.mo', 'locale' => $locale)); $translate->setLocale($locale); $this->bootstrap('view'); $this->getResource('view')->getHelper('translate')->setTranslator($translate); }
content of /languages/ :
gda-en.mo gda-fr.mo <== this one I would like to avoid maintaining
thanks