How do you initialize Zend_Translate in your bootstrap? Regards, Saša Stamenković
On Wed, Oct 7, 2009 at 10:38 PM, ignace <developer.ign...@gmail.com> wrote: > > Ok the code i used is: > > if ($this->_hasParam('language')) { > $language = $this->_getParam('language'); > if ($bootstrap = $this->getInvokeArg('bootstrap')) { > $translateResource = > $bootstrap->getPluginResource('Translate'); > $translate = > $translateResource->getTranslate(); > if (!$translate->isAvailable($language)) { > $options = > $translateResource->getOptions(); > try { > > $translate->setOptions(array('reload' => true)); > > $translate->addTranslation($options['data'], $language); > } catch (Zend_Translate_Exception > $e) {} > } > // is it now available? > if ($translate->isAvailable($language)) { > $translate->setLocale($language); > } > } > } > > Also is it possible for Zend_Translate to read all translation sources in > the directory instead of one? > > > thomasW wrote: > > > > You should give some reproducable code from your side instead of code > from > > ZF. > > Looking at your result you should ask yourself what you are doing that > the > > "nl" files are read as "en". > > Because Zend_Translate has no way to detect for which language the > content > > of a file is when the directory or filename does not reflect this. > > > > Greetings > > Thomas Weidner, I18N Team Leader, Zend Framework > > http://www.thomasweidner.com > > > > ----- Original Message ----- > > From: "ignace" <developer.ign...@gmail.com> > > To: <fw-general@lists.zend.com> > > Sent: Wednesday, October 07, 2009 7:42 PM > > Subject: [fw-general] Zend_Translate & addTranslation > > > > > >> > >> Hi, > >> > >> I have a problem: Zend_Translate loads by default the browser's default > >> language (in my case nl) Then through a navigation I can alter the > >> language > >> in which I want to see the website but it doesn't change it a closer > look > >> showed that Zend_Translate indeed retrieves the translation source as it > >> outputs at some point: > >> > >> 'en' => array > >> 'About us' => 'About us' > >> > >> 'nl' => array > >> 'About us' => 'Over ons' > >> > >> But changes it later on to: > >> > >> 'en' => array > >> 'About us' => 'Over ons' > >> > >> 'nl' => array > >> 'About us' => 'Over ons' > >> > >> This process occurs in Zend_Translate_Adapter at lines 499 - 501 in > >> version > >> 1.10.0dev The lines in question are: > >> > >> if (array_key_exists($key, $temp) && is_array($temp[$key])) { > >> $this->_translate[$key] = $temp[$key] + > >> $this->_translate[$key]; > >> } > >> -- > >> View this message in context: > >> > http://www.nabble.com/Zend_Translate---addTranslation-tp25791169p25791169.html > >> Sent from the Zend Framework mailing list archive at Nabble.com. > > > > > > > > -- > View this message in context: > http://www.nabble.com/Zend_Translate---addTranslation-tp25791169p25793989.html > Sent from the Zend Framework mailing list archive at Nabble.com. > >