Description

Our system has the locale "de_DE@euro". This is not recognized by Zend_Locale, causing most classes using it to error out. Worked with 1.0.2

Comments

Posted by Thomas Weidner (thomas) on 2007-12-12T13:01:03.000+0000

This is much too less information for reproduction...

Also to mention: "de_DE@euro" is no supported locale... locale can eighter have language or language and region. But it should defer to "de" and if no locale can be found an exception should be raised. There is no way to "just error out" !!

Please add the following informations for reproduction:

OS

php version

zf revision

testcode for reproduction

output from testcode

called from where

output of setlocale()

Posted by Christian Weiske (cweiske) on 2007-12-12T13:34:08.000+0000

I am using CentOS (Redhat Linux) with PHP 5.2.5 and Zend Framework 1.0.3.
de_DE@euro is a valid locale that many linux distributions ship.

1 {main}

thrown in /home/cweiske/Dev/cvs/pear/instpear/share/pear/Zend/Locale.php on line 122

Posted by Thomas Weidner (thomas) on 2007-12-12T14:52:34.000+0000

So it does not "just error out"... it returns that the locale can not be detected... this seems to be a normal behaviour, and you are not handling this exception properly.

Please provide output of "setlocale()"... don't set a own locale per hand...

<?php
echo setlocale(LC_ALL, 0);

Please provide information about from where you are calling the script...

Browser, Commandline, ....

Posted by Christian Weiske (cweiske) on 2007-12-12T15:24:41.000+0000

The call of "LANG=de_DE@euro php ..." was an example because on my laptop I do not use it as default locale. On our server, we get
"de_DE@euro" as output of setlocale() when using from cmdline. I'll check out what we get with a browser tomorrow.

Posted by Christian Weiske (cweiske) on 2007-12-12T15:27:36.000+0000

I reported this issue because it worked on ZF 1.0.2, and I do not see why it should stop working now.

Hi
I have the same problem.
If I start my script with an cronjob, ZF can't detact the environment locale:
setlocale(LC_ALL, 0) -> return "C" on SuSE10.3

Than I would like to set the locale manuelly to de_DE@euro or de_DE.UTF-8 but ZF can't detact the locale
setlocale(LC_ALL, 'de_DE@euro')
new Zend_Locale(Zend_Locale::ENVIRONMENT); -> Autodetection of Locale has been failed!

setlocale(LC_ALL, 'de_DE.UTF-8')
new Zend_Locale(Zend_Locale::ENVIRONMENT); -> Autodetection of Locale has been failed!

setlocale(LC_CTYPE, 'de_DE@euro')
new Zend_Locale(Zend_Locale::ENVIRONMENT); -> Autodetection of Locale has been failed!

setlocale(LC_CTYPE, 'de_DE.UTF-8')
new Zend_Locale(Zend_Locale::ENVIRONMENT); -> THIS WORK

Posted by Thomas Weidner (thomas) on 2007-12-14T02:42:20.000+0000

Beside the problem itself, you can handle this situation with the following code instead of just throwing an exception which is displayed to the user: