Zend_Translate automatic language detection

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Zend_Translate automatic language detection

Jörg Hambuch
Hello,

after one and a half days of reading manual and forums, and testing many configuartions, I dare to ask the mailing list now.

If I take the source code from the manual (http://framework.zend.com/manual/en/zend.translate.using.html, 46.9.), it does not act like described there.

- The output in my browser is the following:
de_AT=1;fr=1;en_US=0.8
it_IT: italiano
it_IT: italiano
de: deutsch
de: deutsch

- After what the manual says, I would have expected that:
de_AT=1;fr=1;en_US=0.8
: key
en: english
de: deutsch
it_IT: italiano

- In my bootstrap, there is nothing about Zend_Translate or Zend_locale at all. For testing purposes I just put the code from the manual into my IndexController.

- My browser (firefox) is set to accept de_AT, fr, en_US.

- I put the neccessary translation files (PHP arrays) in APPLICATION_PATH . '/../translations/' and named them it.php, ru.php, en.php es.php and de.php. They look like this:
<?php
return array(
    'key' => 'english'
);

-My IndexController contains the code from the manual plus a few echo's from me. Here it is:
// Let's expect the browser returns this language settings
// HTTP_ACCEPT_LANGUAGE = "de_AT=1;fr=1;en_US=0.8";
echo $_SERVER['HTTP_ACCEPT_LANGUAGE'] . '<br />';

// Example 1:
$translate = new Zend_Translate("gettext", "\my_it.mo", "it_IT");
$translate->addTranslation("\my_es.mo","es_UG");
// no fitting language found, return the messageid
echo $translate->getLocale() . ': ';
echo $translate->_('key') . '<br />';

// Example 2:
$translate = new Zend_Translate("gettext", "\my_en.mo", "en_US");
$translate->addTranslation("\my_it.mo","it_IT");
// best found fitting language is "en_US"
echo $translate->getLocale() . ': ';
echo $translate->_('key') . '<br />';

// Example 3:
$translate = new Zend_Translate("gettext", "\my_it.mo", "it_IT");
$translate->addTranslation("\my_de.mo","de");
// best found fitting language is "de" because "de_AT" will be
// degraded to "de"
echo $translate->getLocale() . ': ';
echo $translate->_('key') . '<br />';

// Example 4:
$translate = new Zend_Translate("gettext", "\my_it.mo", "it_IT");
$translate->addTranslation("\my_ru.mo","ru");
$translate->setLocale("it_IT");
$translate->addTranslation("\my_de.mo","de");
// returns "it_IT" as translation source
echo $translate->getLocale() . ': ';
echo $translate->_('key') . '<br />';

I use Zend Framework 1.6.2, PHP 5.2.6 on Ubuntu with LAMPP.

Could anyone please tell me, what is the problem here?

Best regards,
Jörg Hambuch
Reply | Threaded
Open this post in threaded view
|

Re: Zend_Translate automatic language detection

Thomas Weidner
Jörg,

You set the language manually within Zend_Translate in all examples and
don't use automatic language detection at all.
If you want detection you should set the locale (setLocale) to "browser"
when you only want browser locales, or "auto" if you need a complete
automatic detection.
Autodetection works best when you combine it with scanning.

Given your examples, all seems to work like expected/coded.

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

----- Original Message -----
From: "Jörg Hambuch" <[hidden email]>
To: <[hidden email]>
Sent: Wednesday, November 05, 2008 12:46 PM
Subject: [fw-general] Zend_Translate automatic language detection



Hello,

after one and a half days of reading manual and forums, and testing many
configuartions, I dare to ask the mailing list now.

If I take the source code from the manual
(http://framework.zend.com/manual/en/zend.translate.using.html, 46.9.), it
does not act like described there.

- The output in my browser is the following:
de_AT=1;fr=1;en_US=0.8
it_IT: italiano
it_IT: italiano
de: deutsch
de: deutsch

- After what the manual says, I would have expected that:
de_AT=1;fr=1;en_US=0.8
: key
en: english
de: deutsch
it_IT: italiano

- In my bootstrap, there is nothing about Zend_Translate or Zend_locale at
all. For testing purposes I just put the code from the manual into my
IndexController.

- My browser (firefox) is set to accept de_AT, fr, en_US.

- I put the neccessary translation files (PHP arrays) in APPLICATION_PATH .
'/../translations/' and named them it.php, ru.php, en.php es.php and de.php.
They look like this:
<?php
return array(
    'key' => 'english'
);

-My IndexController contains the code from the manual plus a few echo's from
me. Here it is:
// Let's expect the browser returns this language settings
// HTTP_ACCEPT_LANGUAGE = "de_AT=1;fr=1;en_US=0.8";
echo $_SERVER['HTTP_ACCEPT_LANGUAGE'] . '<br />';

// Example 1:
$translate = new Zend_Translate("gettext", "\my_it.mo", "it_IT");
$translate->addTranslation("\my_es.mo","es_UG");
// no fitting language found, return the messageid
echo $translate->getLocale() . ': ';
echo $translate->_('key') . '<br />';

// Example 2:
$translate = new Zend_Translate("gettext", "\my_en.mo", "en_US");
$translate->addTranslation("\my_it.mo","it_IT");
// best found fitting language is "en_US"
echo $translate->getLocale() . ': ';
echo $translate->_('key') . '<br />';

// Example 3:
$translate = new Zend_Translate("gettext", "\my_it.mo", "it_IT");
$translate->addTranslation("\my_de.mo","de");
// best found fitting language is "de" because "de_AT" will be
// degraded to "de"
echo $translate->getLocale() . ': ';
echo $translate->_('key') . '<br />';

// Example 4:
$translate = new Zend_Translate("gettext", "\my_it.mo", "it_IT");
$translate->addTranslation("\my_ru.mo","ru");
$translate->setLocale("it_IT");
$translate->addTranslation("\my_de.mo","de");
// returns "it_IT" as translation source
echo $translate->getLocale() . ': ';
echo $translate->_('key') . '<br />';

I use Zend Framework 1.6.2, PHP 5.2.6 on Ubuntu with LAMPP.

Could anyone please tell me, what is the problem here?

Best regards,
Jörg Hambuch
--
View this message in context:
http://www.nabble.com/Zend_Translate-automatic-language-detection-tp20340272p20340272.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Zend_Translate automatic language detection

Jörg Hambuch
Hi, Thomas,

thanks for your ultra-quick reply.

Why do the examples use no auto detection? The manual says: "as long as you only add new translation sources with the addTranslation() method Zend_Translate will automatically set the best fitting language for your environment. So normally you will not need to call setLocale()." Doesn't that sound, as if Zend_Translate is using automatic detection as a default?

Furthermore the manual says "After setting a language manually with the setLocale() method the automatically detection will be switched off...". For me, that says: if you do NOT use setLocale(), it is set to 'auto' by default.


The whole manual part (except the example) reads like this:

46.3.8.1. Automatically handling of languages

Note that as long as you only add new translation sources with the addTranslation() method Zend_Translate will automatically set the best fitting language for your environment. So normally you will not need to call setLocale().

The algorithmus will search for the best fitting locale depending on the users browser and your environment. See the following example for details:

[... Example here ...]

After setting a language manually with the setLocale() method the automatically detection will be switched off and overridden.

If you want to use the automatic again, you can set the language auto with setLocale() which will reactivate the automatically detection for Zend_Translate.


Best regards,
Jörg


Thomas Weidner schrieb:
Jörg,

You set the language manually within Zend_Translate in all examples and don't use automatic language detection at all.
If you want detection you should set the locale (setLocale) to "browser" when you only want browser locales, or "auto" if you need a complete automatic detection.
Autodetection works best when you combine it with scanning.

Given your examples, all seems to work like expected/coded.

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

----- Original Message ----- From: "Jörg Hambuch" [hidden email]
To: [hidden email]
Sent: Wednesday, November 05, 2008 12:46 PM
Subject: [fw-general] Zend_Translate automatic language detection



Hello,

after one and a half days of reading manual and forums, and testing many
configuartions, I dare to ask the mailing list now.

If I take the source code from the manual
(http://framework.zend.com/manual/en/zend.translate.using.html, 46.9.), it
does not act like described there.

- The output in my browser is the following:
de_AT=1;fr=1;en_US=0.8
it_IT: italiano
it_IT: italiano
de: deutsch
de: deutsch

- After what the manual says, I would have expected that:
de_AT=1;fr=1;en_US=0.8
: key
en: english
de: deutsch
it_IT: italiano

- In my bootstrap, there is nothing about Zend_Translate or Zend_locale at
all. For testing purposes I just put the code from the manual into my
IndexController.

- My browser (firefox) is set to accept de_AT, fr, en_US.

- I put the neccessary translation files (PHP arrays) in APPLICATION_PATH .
'/../translations/' and named them it.php, ru.php, en.php es.php and de.php.
They look like this:
<?php
return array(
   'key' => 'english'
);

-My IndexController contains the code from the manual plus a few echo's from
me. Here it is:
// Let's expect the browser returns this language settings
// HTTP_ACCEPT_LANGUAGE = "de_AT=1;fr=1;en_US=0.8";
echo $_SERVER['HTTP_ACCEPT_LANGUAGE'] . '<br />';

// Example 1:
$translate = new Zend_Translate("gettext", "\my_it.mo", "it_IT");
$translate->addTranslation("\my_es.mo","es_UG");
// no fitting language found, return the messageid
echo $translate->getLocale() . ': ';
echo $translate->_('key') . '<br />';

// Example 2:
$translate = new Zend_Translate("gettext", "\my_en.mo", "en_US");
$translate->addTranslation("\my_it.mo","it_IT");
// best found fitting language is "en_US"
echo $translate->getLocale() . ': ';
echo $translate->_('key') . '<br />';

// Example 3:
$translate = new Zend_Translate("gettext", "\my_it.mo", "it_IT");
$translate->addTranslation("\my_de.mo","de");
// best found fitting language is "de" because "de_AT" will be
// degraded to "de"
echo $translate->getLocale() . ': ';
echo $translate->_('key') . '<br />';

// Example 4:
$translate = new Zend_Translate("gettext", "\my_it.mo", "it_IT");
$translate->addTranslation("\my_ru.mo","ru");
$translate->setLocale("it_IT");
$translate->addTranslation("\my_de.mo","de");
// returns "it_IT" as translation source
echo $translate->getLocale() . ': ';
echo $translate->_('key') . '<br />';

I use Zend Framework 1.6.2, PHP 5.2.6 on Ubuntu with LAMPP.

Could anyone please tell me, what is the problem here?

Best regards,
Jörg Hambuch
Reply | Threaded
Open this post in threaded view
|

Re: Zend_Translate automatic language detection

Jörg Hambuch
In reply to this post by Thomas Weidner
Hi, again, Thomas,

if I use setLocale('browser'), I get an exception, that 'de_AT' first
has to be added before it can be set as a locale.

Here is my original-from-the-manual-code:

// Beispiel 2:
$translate = new Zend_Translate('array', APPLICATION_PATH .
'/../translations/en.php', "en_US");
$translate->addTranslation(APPLICATION_PATH .
'/../translations/it.php',"it_IT");
// Die am besten passende Sprache ist "en_US"

$translate->setLocale('auto'); // added because Thomas says so ;-)

print_r($translate->getList()) . '<br />';
echo $translate->getLocale() . ': ';
echo $translate->_('key') . '<br />';

In the example part I tried this, there are translations for en_US and
it_IT. The browser accepts de_AT, fr and en_US. So, why do I get an
exception instead of the en_US translation? It seems, that
Zend_Translate doesn't look for translations of all languages accepted
by the browser, correct? I would have expected, that Zend_Translate
looks for translations like this: de_AT -> de -> fr -> en_US -> en. In
my case, it should stop searching at en_US, because this translation exists.

Best regards,
Jörg


Thomas Weidner schrieb:

> Jörg,
>
> You set the language manually within Zend_Translate in all examples
> and don't use automatic language detection at all.
> If you want detection you should set the locale (setLocale) to
> "browser" when you only want browser locales, or "auto" if you need a
> complete automatic detection.
> Autodetection works best when you combine it with scanning.
>
> Given your examples, all seems to work like expected/coded.
>
> Greetings
> Thomas Weidner, I18N Team Leader, Zend Framework
> http://www.thomasweidner.com
>
> ----- Original Message ----- From: "Jörg Hambuch" <[hidden email]>
> To: <[hidden email]>
> Sent: Wednesday, November 05, 2008 12:46 PM
> Subject: [fw-general] Zend_Translate automatic language detection
>
>
>
> Hello,
>
> after one and a half days of reading manual and forums, and testing many
> configuartions, I dare to ask the mailing list now.
>
> If I take the source code from the manual
> (http://framework.zend.com/manual/en/zend.translate.using.html,
> 46.9.), it
> does not act like described there.
>
> - The output in my browser is the following:
> de_AT=1;fr=1;en_US=0.8
> it_IT: italiano
> it_IT: italiano
> de: deutsch
> de: deutsch
>
> - After what the manual says, I would have expected that:
> de_AT=1;fr=1;en_US=0.8
> : key
> en: english
> de: deutsch
> it_IT: italiano
>
> - In my bootstrap, there is nothing about Zend_Translate or
> Zend_locale at
> all. For testing purposes I just put the code from the manual into my
> IndexController.
>
> - My browser (firefox) is set to accept de_AT, fr, en_US.
>
> - I put the neccessary translation files (PHP arrays) in
> APPLICATION_PATH .
> '/../translations/' and named them it.php, ru.php, en.php es.php and
> de.php.
> They look like this:
> <?php
> return array(
>    'key' => 'english'
> );
>
> -My IndexController contains the code from the manual plus a few
> echo's from
> me. Here it is:
> // Let's expect the browser returns this language settings
> // HTTP_ACCEPT_LANGUAGE = "de_AT=1;fr=1;en_US=0.8";
> echo $_SERVER['HTTP_ACCEPT_LANGUAGE'] . '<br />';
>
> // Example 1:
> $translate = new Zend_Translate("gettext", "\my_it.mo", "it_IT");
> $translate->addTranslation("\my_es.mo","es_UG");
> // no fitting language found, return the messageid
> echo $translate->getLocale() . ': ';
> echo $translate->_('key') . '<br />';
>
> // Example 2:
> $translate = new Zend_Translate("gettext", "\my_en.mo", "en_US");
> $translate->addTranslation("\my_it.mo","it_IT");
> // best found fitting language is "en_US"
> echo $translate->getLocale() . ': ';
> echo $translate->_('key') . '<br />';
>
> // Example 3:
> $translate = new Zend_Translate("gettext", "\my_it.mo", "it_IT");
> $translate->addTranslation("\my_de.mo","de");
> // best found fitting language is "de" because "de_AT" will be
> // degraded to "de"
> echo $translate->getLocale() . ': ';
> echo $translate->_('key') . '<br />';
>
> // Example 4:
> $translate = new Zend_Translate("gettext", "\my_it.mo", "it_IT");
> $translate->addTranslation("\my_ru.mo","ru");
> $translate->setLocale("it_IT");
> $translate->addTranslation("\my_de.mo","de");
> // returns "it_IT" as translation source
> echo $translate->getLocale() . ': ';
> echo $translate->_('key') . '<br />';
>
> I use Zend Framework 1.6.2, PHP 5.2.6 on Ubuntu with LAMPP.
>
> Could anyone please tell me, what is the problem here?
>
> Best regards,
> Jörg Hambuch
Reply | Threaded
Open this post in threaded view
|

Re: Zend_Translate automatic language detection

Thomas Weidner
In reply to this post by Jörg Hambuch
I would say that example and text do not fit.
For the old API you simply have to check if the language is available
(isAvailable) and if not set the wished language manually.

Something like
if ($translate->isAvailable($locale->getLocale())) {
   $translate->setLocale($locale->getLocale());
} else {
   $translate->setLocale('en');
}

The new API allows setting a language which does not exist.

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

----- Original Message -----
From: "Jörg Hambuch" <[hidden email]>
To: <[hidden email]>
Sent: Wednesday, November 05, 2008 1:38 PM
Subject: Re: [fw-general] Zend_Translate automatic language detection


> Hi, Thomas,
>
> thanks for your ultra-quick reply.
>
> Why do the examples use no auto detection? The manual says: "as long as
> you only add new translation sources with the |addTranslation()| method
> |Zend_Translate| will automatically set the best fitting language for
> your environment. So normally you will not need to call |setLocale()|."
> Doesn't that sound, as if Zend_Translate is using automatic detection as
> a default?
>
> Furthermore the manual says "After setting a language manually with the
> |setLocale()| method the automatically detection will be switched
> off...". For me, that says: if you do NOT use setLocale(), it is set to
> 'auto' by default.
>
>
> The whole manual part (except the example) reads like this:
>
>
>        46.3.8.1. Automatically handling of languages
>
> Note that as long as you only add new translation sources with the
> |addTranslation()| method |Zend_Translate| will automatically set the
> best fitting language for your environment. So normally you will not
> need to call |setLocale()|.
>
> The algorithmus will search for the best fitting locale depending on the
> users browser and your environment. See the following example for details:
>
> [... Example here ...]
>
> After setting a language manually with the |setLocale()| method the
> automatically detection will be switched off and overridden.
>
> If you want to use the automatic again, you can set the language *auto*
> with |setLocale()| which will reactivate the automatically detection for
> |Zend_Translate|.
>
>
> Best regards,
> Jörg
>
>
> Thomas Weidner schrieb:
>> Jörg,
>>
>> You set the language manually within Zend_Translate in all examples
>> and don't use automatic language detection at all.
>> If you want detection you should set the locale (setLocale) to
>> "browser" when you only want browser locales, or "auto" if you need a
>> complete automatic detection.
>> Autodetection works best when you combine it with scanning.
>>
>> Given your examples, all seems to work like expected/coded.
>>
>> Greetings
>> Thomas Weidner, I18N Team Leader, Zend Framework
>> http://www.thomasweidner.com
>>
>> ----- Original Message ----- From: "Jörg Hambuch" <[hidden email]>
>> To: <[hidden email]>
>> Sent: Wednesday, November 05, 2008 12:46 PM
>> Subject: [fw-general] Zend_Translate automatic language detection
>>
>>
>>
>> Hello,
>>
>> after one and a half days of reading manual and forums, and testing many
>> configuartions, I dare to ask the mailing list now.
>>
>> If I take the source code from the manual
>> (http://framework.zend.com/manual/en/zend.translate.using.html,
>> 46.9.), it
>> does not act like described there.
>>
>> - The output in my browser is the following:
>> de_AT=1;fr=1;en_US=0.8
>> it_IT: italiano
>> it_IT: italiano
>> de: deutsch
>> de: deutsch
>>
>> - After what the manual says, I would have expected that:
>> de_AT=1;fr=1;en_US=0.8
>> : key
>> en: english
>> de: deutsch
>> it_IT: italiano
>>
>> - In my bootstrap, there is nothing about Zend_Translate or
>> Zend_locale at
>> all. For testing purposes I just put the code from the manual into my
>> IndexController.
>>
>> - My browser (firefox) is set to accept de_AT, fr, en_US.
>>
>> - I put the neccessary translation files (PHP arrays) in
>> APPLICATION_PATH .
>> '/../translations/' and named them it.php, ru.php, en.php es.php and
>> de.php.
>> They look like this:
>> <?php
>> return array(
>>    'key' => 'english'
>> );
>>
>> -My IndexController contains the code from the manual plus a few
>> echo's from
>> me. Here it is:
>> // Let's expect the browser returns this language settings
>> // HTTP_ACCEPT_LANGUAGE = "de_AT=1;fr=1;en_US=0.8";
>> echo $_SERVER['HTTP_ACCEPT_LANGUAGE'] . '<br />';
>>
>> // Example 1:
>> $translate = new Zend_Translate("gettext", "\my_it.mo", "it_IT");
>> $translate->addTranslation("\my_es.mo","es_UG");
>> // no fitting language found, return the messageid
>> echo $translate->getLocale() . ': ';
>> echo $translate->_('key') . '<br />';
>>
>> // Example 2:
>> $translate = new Zend_Translate("gettext", "\my_en.mo", "en_US");
>> $translate->addTranslation("\my_it.mo","it_IT");
>> // best found fitting language is "en_US"
>> echo $translate->getLocale() . ': ';
>> echo $translate->_('key') . '<br />';
>>
>> // Example 3:
>> $translate = new Zend_Translate("gettext", "\my_it.mo", "it_IT");
>> $translate->addTranslation("\my_de.mo","de");
>> // best found fitting language is "de" because "de_AT" will be
>> // degraded to "de"
>> echo $translate->getLocale() . ': ';
>> echo $translate->_('key') . '<br />';
>>
>> // Example 4:
>> $translate = new Zend_Translate("gettext", "\my_it.mo", "it_IT");
>> $translate->addTranslation("\my_ru.mo","ru");
>> $translate->setLocale("it_IT");
>> $translate->addTranslation("\my_de.mo","de");
>> // returns "it_IT" as translation source
>> echo $translate->getLocale() . ': ';
>> echo $translate->_('key') . '<br />';
>>
>> I use Zend Framework 1.6.2, PHP 5.2.6 on Ubuntu with LAMPP.
>>
>> Could anyone please tell me, what is the problem here?
>>
>> Best regards,
>> Jörg Hambuch
>

Reply | Threaded
Open this post in threaded view
|

Re: Zend_Translate automatic language detection

Thomas Weidner
In reply to this post by Jörg Hambuch
No, rerouting is for now not supported.
It will come in future.

Also in your release you can not set a non-availalble language without
getting an exception.
In 1.7 this is possible.

So you first have to check if the language is available with isAvailable()
before setting it.

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

----- Original Message -----
From: "Jörg Hambuch" <[hidden email]>
Cc: <[hidden email]>
Sent: Wednesday, November 05, 2008 2:06 PM
Subject: Re: [fw-general] Zend_Translate automatic language detection


> Hi, again, Thomas,
>
> if I use setLocale('browser'), I get an exception, that 'de_AT' first has
> to be added before it can be set as a locale.
>
> Here is my original-from-the-manual-code:
>
> // Beispiel 2:
> $translate = new Zend_Translate('array', APPLICATION_PATH .
> '/../translations/en.php', "en_US");
> $translate->addTranslation(APPLICATION_PATH .
> '/../translations/it.php',"it_IT");
> // Die am besten passende Sprache ist "en_US"
>
> $translate->setLocale('auto'); // added because Thomas says so ;-)
>
> print_r($translate->getList()) . '<br />';
> echo $translate->getLocale() . ': ';
> echo $translate->_('key') . '<br />';
>
> In the example part I tried this, there are translations for en_US and
> it_IT. The browser accepts de_AT, fr and en_US. So, why do I get an
> exception instead of the en_US translation? It seems, that Zend_Translate
> doesn't look for translations of all languages accepted by the browser,
> correct? I would have expected, that Zend_Translate looks for translations
> like this: de_AT -> de -> fr -> en_US -> en. In my case, it should stop
> searching at en_US, because this translation exists.
>
> Best regards,
> Jörg
>
>
> Thomas Weidner schrieb:
>> Jörg,
>>
>> You set the language manually within Zend_Translate in all examples and
>> don't use automatic language detection at all.
>> If you want detection you should set the locale (setLocale) to "browser"
>> when you only want browser locales, or "auto" if you need a complete
>> automatic detection.
>> Autodetection works best when you combine it with scanning.
>>
>> Given your examples, all seems to work like expected/coded.
>>
>> Greetings
>> Thomas Weidner, I18N Team Leader, Zend Framework
>> http://www.thomasweidner.com
>>
>> ----- Original Message ----- From: "Jörg Hambuch" <[hidden email]>
>> To: <[hidden email]>
>> Sent: Wednesday, November 05, 2008 12:46 PM
>> Subject: [fw-general] Zend_Translate automatic language detection
>>
>>
>>
>> Hello,
>>
>> after one and a half days of reading manual and forums, and testing many
>> configuartions, I dare to ask the mailing list now.
>>
>> If I take the source code from the manual
>> (http://framework.zend.com/manual/en/zend.translate.using.html, 46.9.),
>> it
>> does not act like described there.
>>
>> - The output in my browser is the following:
>> de_AT=1;fr=1;en_US=0.8
>> it_IT: italiano
>> it_IT: italiano
>> de: deutsch
>> de: deutsch
>>
>> - After what the manual says, I would have expected that:
>> de_AT=1;fr=1;en_US=0.8
>> : key
>> en: english
>> de: deutsch
>> it_IT: italiano
>>
>> - In my bootstrap, there is nothing about Zend_Translate or Zend_locale
>> at
>> all. For testing purposes I just put the code from the manual into my
>> IndexController.
>>
>> - My browser (firefox) is set to accept de_AT, fr, en_US.
>>
>> - I put the neccessary translation files (PHP arrays) in APPLICATION_PATH
>> .
>> '/../translations/' and named them it.php, ru.php, en.php es.php and
>> de.php.
>> They look like this:
>> <?php
>> return array(
>>    'key' => 'english'
>> );
>>
>> -My IndexController contains the code from the manual plus a few echo's
>> from
>> me. Here it is:
>> // Let's expect the browser returns this language settings
>> // HTTP_ACCEPT_LANGUAGE = "de_AT=1;fr=1;en_US=0.8";
>> echo $_SERVER['HTTP_ACCEPT_LANGUAGE'] . '<br />';
>>
>> // Example 1:
>> $translate = new Zend_Translate("gettext", "\my_it.mo", "it_IT");
>> $translate->addTranslation("\my_es.mo","es_UG");
>> // no fitting language found, return the messageid
>> echo $translate->getLocale() . ': ';
>> echo $translate->_('key') . '<br />';
>>
>> // Example 2:
>> $translate = new Zend_Translate("gettext", "\my_en.mo", "en_US");
>> $translate->addTranslation("\my_it.mo","it_IT");
>> // best found fitting language is "en_US"
>> echo $translate->getLocale() . ': ';
>> echo $translate->_('key') . '<br />';
>>
>> // Example 3:
>> $translate = new Zend_Translate("gettext", "\my_it.mo", "it_IT");
>> $translate->addTranslation("\my_de.mo","de");
>> // best found fitting language is "de" because "de_AT" will be
>> // degraded to "de"
>> echo $translate->getLocale() . ': ';
>> echo $translate->_('key') . '<br />';
>>
>> // Example 4:
>> $translate = new Zend_Translate("gettext", "\my_it.mo", "it_IT");
>> $translate->addTranslation("\my_ru.mo","ru");
>> $translate->setLocale("it_IT");
>> $translate->addTranslation("\my_de.mo","de");
>> // returns "it_IT" as translation source
>> echo $translate->getLocale() . ': ';
>> echo $translate->_('key') . '<br />';
>>
>> I use Zend Framework 1.6.2, PHP 5.2.6 on Ubuntu with LAMPP.
>>
>> Could anyone please tell me, what is the problem here?
>>
>> Best regards,
>> Jörg Hambuch