You missed one thing...

You can have empty-byte files:
BUT:
When there is no translation available at all, so if there is not a single translation, you will get an error setting the language.

WHEN you set another locale with setLocale it checks if the language exists by testing if there is anything to translate at all. Setting a language without having a translation is not possible.

So you can have multiple translation files and some of them are empty files... but minimum one single translation must be available.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

----- Original Message ----- From: "mbneto" <[EMAIL PROTECTED]>
To: "Thomas Weidner" <[EMAIL PROTECTED]>
Cc: "Zend Framework General" <[email protected]>
Sent: Monday, August 04, 2008 11:04 PM
Subject: Re: [fw-general] Bug or feature in Zend_Translate 1.5.3/1.6RC1


Hi Thomas,

Thanks for the reply.

I thought I made myself clear.   Here is the simplest code that can cause
the problem

require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();

$tr = new Zend_Translate('csv', 'en_US.txt', 'en_US');
$tr->setLocale('en_US');

If en_US.txt exists but has zero bytes I get "Zend_Translate_Exception:
Language (en_US) has to be added before it can be used"

If I add a single like test;test  everything goes fine.

In this example I only have one language so the setLocale should be
unnecessary but in my real app I have more than two so when the user chooses
one I use the setLocale.

About the #zftalk how can I access this ? (off-list if found appropriate).
I don't access IRC in more than a decade :)

Thanks.

On Mon, Aug 4, 2008 at 12:58 PM, Thomas Weidner <[EMAIL PROTECTED]>
wrote:

When there would be a problem when adding the file you would get an
exception.

Why do you not simply debug your code ?
Look which files are added, look which locale was found, look what's
requested to be translated.
All needed methods and functionallities are available. Just call them and
you will see what's going wrong.

To note: Without any data, and believe me... it works here but not there is
not enough data for reproduction, there is no way to help you.

You could just go to #zftalk... there are always people online who can help
you.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

----- Original Message ----- From: "mbneto" <[EMAIL PROTECTED]>
To: "Zend Framework General" <[email protected]>
Sent: Monday, August 04, 2008 5:27 PM
Subject: [fw-general] Bug or feature in Zend_Translate 1.5.3/1.6RC1



 Hi,

Before opening a bug I'd like to know if this is an expected behavior
change.

Until 1.5.2 I could have an empty (zero bytes) file used with
Zend_Translate
('csv', $path, $locale).  Now with 1.5.3 and 1.6RC1 I can't .   it does
not
complain when I create the object, it does not complain when I use
addTranslation, but aborts with 'locale X must be added before it is used'
when I call the setLocale(X).

Thanks.





Reply via email to