The manual notes that Zend_Currency MUST have a full qualified locale (language AND region).

How should Zend_Currency know which region you mean when you give "en" for english?
Do you mean USA, England or Australia for example.

As the "default" locale does NOT define a region (default is "en") a fallback is not possible. Also when you defined "en_US" and your user gives "sk", your user probably don't want to fall back to USA.

The correct usage is clearly described within the manual.

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

----- Original Message ----- From: "Arthur M. Kang" <[email protected]>
To: "Zend Framework - General" <[email protected]>
Sent: Thursday, March 25, 2010 1:28 AM
Subject: [fw-general] Help With Zend_Currency Throwing Exception


I'm trying to set a locale and have use that information throughout my
site for languages, currency, and dates.  I would assume this is pretty
standard.  The problem occurs when setting a locale without a region and
then trying to instantiate a Zend_Currency object using that locale.
Zend_Date seems to handle it OK, but that may just depend on the
language portion of the locale.  A snippet of the test is shown below.

Zend_Locale::setDefault('en_US');
$locale = new Zend_Locale('ko');
Zend_Registry::set('Zend_Locale', $locale);

$date = new Zend_Date();
echo "$date<br />\n";

$currency = new Zend_Currency();
echo "$currency<br />\n";

I would guess that the logical fallback should be either the region
portion from the default, or somehow "guess" at a default region for the
corresponding language.

Anyone have any tips on how to proceed and what would be the best way or
shed any other interesting light on this?

Thanks in advance.

Arthur


Reply via email to