But where would Zend_Locale keep its data if you call Zend_Date in another file?

You could store it in Zend_Registry:

  1.
     // in your bootstrap file
  2.
     $locale = new Zend_Locale('de_AT');
  3.
     Zend_Registry::set('Zend_Locale', $locale);
  4.
  5.
     // somewhere in your application
  6.
     $date = new Zend_Date('31.Feb.2007');

I took this from the documentation btw :P
http://framework.zend.com/manual/en/zend.date.overview.html

Regards,
Maghiel



On 26-9-2010 1:13, debussy007 wrote:
Hi,

I have the following code in bootstrap (as early as possible, after
Autoloader init) :

$locale = new Zend_Locale('de');
Zend_Locale::setDefault($locale);

Then in some file :

$date = new Zend_Date();
echo $date->get(Zend_Date::WEEKDAY) . '<br>';

It will always return me french.
I can return german by changing it to :

$date = new Zend_Date(NULL, NULL, Zend_Locale('de'));
echo $date->get(Zend_Date::WEEKDAY) . '<br>';

However, I would like it to work with Zend_Locale::setDefault() to avoid to
explicitely specify the locale each time.

Why doesn't it work for me ?

Reply via email to