How is that possible as it loads the default language from that directory I just retrieve it back from my bootstrap resource and append $language.csv?
Best regards, Ignace thomasW wrote: > > I expect that the file "directory" does not exist, whereas the file > "en.csv" > does. > > Greetings > Thomas Weidner, I18N Team Leader, Zend Framework > http://www.thomasweidner.com > > ----- Original Message ----- > From: "Ignace Knops" <developer.ign...@gmail.com> > To: "Thomas Weidner" <thomas.weid...@gmx.at> > Sent: Friday, October 09, 2009 1:55 PM > Subject: Re: [fw-general] Zend_Translate & addTranslation > > >> Hi, >> >> I have managed to get it working instead of just doing: >> >> $translate->setOptions(array('clear' => true)); >> $translate->addTranslation('path/to/language/directory', 'en'); // >> 'path/to/language/directory = contentsof $options['data'], 'en' => >> contentsof $language >> >> I rewrote it to: >> >> $translate->setOptions(array('clear' => true)); >> $translate->addTranslation('path/to/language/en.csv', 'en'); // >> 'path/to/language/directory = contentsof $options['data'], 'en' => >> contentsof $language >> >> Any ideas on why this works and the previous doesn't? >> >> Best regards, >> Ignace >> >> 2009/10/8 Thomas Weidner <thomas.weid...@gmx.at> >> >>> So you are loading always the same directory regardless of what your >>> user >>> sends ? >>> Does not seem to be a correct behaviour in my eyes. >>> >>> Regarding loading all languages at once, simply look into the manual for >>> the requirements and the needed options. >>> >>> 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 10:38 PM >>> Subject: Re: [fw-general] Zend_Translate & addTranslation >>> >>> >>> >>>> 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. >>>> >>> >>> >> >> >> -- >> Met vriendelijke groeten, >> Ignace Knops >> > > > -- View this message in context: http://www.nabble.com/Zend_Translate---addTranslation-tp25791169p25820309.html Sent from the Zend Framework mailing list archive at Nabble.com.