Hi Rob,

My code snippet seems to be handling this.  I just did a quick test whereby
I had the following language dir. Structure:

En
 -> lang.en
En_US
 -> lang.en_US

If I set my browser to en-us then it picks up the en_US lang file, if I
don't have a language set in my browser it defaults to en.

As, stated before don't use the addTranslation method, this didn't work for
me either and I had no end of troubles.

- Robert 

-----Original Message-----
From: Rob L [mailto:[EMAIL PROTECTED] 
Sent: 08 April 2008 13:51
To: fw-general@lists.zend.com
Subject: Re: [fw-general] Zend_Translate doesn't cache when addTranslation
is called


Thomas,

Thank you for such a quick and detailed reply to my question. I was
originally using the directory search with a constructor like this:

$translate = new Zend_Translate('[our custom adapter]', '/path_here', null,
array('scan' => Zend_Translate::LOCALE_FILENAME));

I had several translation files in a single directory:

en.txt
de.txt
...
zh_CN.txt
zh_TW.txt
...

en and de (and any other 2-letter language code) worked fine. But the
problem was that zh_CN and zh_TW were both getting saved under the key "zh".
When I tried to access the data like this...

if($translate->isAvailable('zh_CN'))
             
...it would be false. So then I changed to call addTranslation once for
every language like this...

$translate->addTranslation('/path_here/zh_CN.txt', 'zh_CN');

...then when I call isAvailable('zh_CN') it would be true. Is there a
different way to support both zh_CN and zh_TW?

Thanks,
Rob
--
View this message in context:
http://www.nabble.com/Zend_Translate-doesn%27t-cache-when-addTranslation-is-
called-tp16539888p16558218.html
Sent from the Zend Framework mailing list archive at Nabble.com.


________________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs Email
Security Service and the Macro 4 plc internal virus protection system.
________________________________________________________________________


________________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system.
________________________________________________________________________

Reply via email to