Ok, I've seen the solution, sorry

It's only matter of adding translations with

$tra->addTranslation() in order to cache "one big cache file" for all the
translations and use the wanted one selecting it with $tra->setLocale()


On Dec 18, 2007 10:15 AM, Xavier Vidal Piera <[EMAIL PROTECTED]> wrote:

> Is Zend_Translate able to cache more than one different locale files?
>
> If I do:
>
> ...
> $locale = $user['locale'];
> $tra = new Zend_Translate('csv', Zend_Registry::get('path.usr') .
> '/default/translations/index/' . $locale . '.csv', $locale);
> $tra->setLocale($locale);
> echo $this->escape($tra->_('truck'));
>
> The "en" translation file gets cached,
>
> but If i login with another user that have "es" locale, a exception is
> thrown:
>
> *Fatal error*: Uncaught exception 'Zend_Translate_Exception' with message
> 'Language (es_ES) has to be added before it can be used.' in C:\Documents
> and Settings\xvidal\Mis
> documentos\xaviervidal.net\lib\Zend\Translate\Adapter.php:209 Stack trace:
> #0 [internal function]: Zend_Translate_Adapter->setLocale('es_ES') #1
> C:\Documents and Settings\xvidal\Mis
> documentos\xaviervidal.net\lib\Zend\Translate.php(150):
> call_user_func_array(Array, Array) #2 [internal function]:
> Zend_Translate->__call('setLocale', Array) #3 C:\Documents and
> Settings\xvidal\Mis
> documentos\xaviervidal.net\usr\admin\views\scripts\index\index.php(4):
> Zend_Translate->setLocale('es_ES') #4 C:\Documents and Settings\xvidal\Mis
> documentos\xaviervidal.net\lib\Zend\View.php(46): include('C:\Documents
> an...') #5 C:\Documents and Settings\xvidal\Mis
> documentos\xaviervidal.net\lib\Zend\View\Abstract.php(765):
> Zend_View->_run('C:\Documents an...') #6 C:\Documents and
> Settings\xvidal\Mis
> documentos\xaviervidal.net\lib\Zend\Controller\Action\Helper\ViewRenderer.php(859):
> in *C:\Documents and Settings\xvidal\Mis
> documentos\xaviervidal.net\lib\Zend\Translate\Adapter.php* on line *209*
>
> --
> Xavier Vidal Piera
> Enginyer Tècnic Informàtic de Gestió
> Tècnic Especialista Informàtic d'equips
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> http://web.xaviervidal.net
> 610.68.41.78




-- 
Xavier Vidal Piera
Enginyer Tècnic Informàtic de Gestió
Tècnic Especialista Informàtic d'equips
[EMAIL PROTECTED]
[EMAIL PROTECTED]
http://web.xaviervidal.net
610.68.41.78

Reply via email to