
* Zend_Form
To have them all use the same {{Zend_Translate}} instance, simply place it in the registry with the key "Zend_Translate":
{code:php}
Zend_Registry::set('Zend_Translate', $translate);
{code}
{cloak}
{toggle-cloak:id=ApplicationWideLocale} *How can I use the same locale everywhere?*
{cloak:id=ApplicationWideLocale}
With ZF 1.7 an application wide locale is supported. You can do the following in your bootstrap file:
{code:php}
$locale = new Zend_Locale('en');
Zend_Registry::set('Zend_Locale', $locale);
{code}
From now on, all locale aware components will use your locale object stored in the registry as long as you don't give another one manually.
{cloak}
{toggle-cloak:id=FalseYear} *Why are my dates formatted wrong? Why do I get the false year value?*
{cloak:id=FalseYear}
When using own formats in your code you could come to a situation where you get for example 29.12.2009, but you expected to get 29.12.2008.
There is one year difference: 2009 instead of 2008. You should use the lower cased year constant. See this example:
{code:php}
$date->toString('dd.MM.yyyy');
{code}
Note the lower cased "y" which makes the difference and outputs the real year.
{cloak}
{toggle-cloak:id=DebugZendDate} *How can I debug Zend_Date in a simple way?*
{cloak:id=DebugZendDate}
When you think that you are getting wrong output from Zend_Date then it's often needed to see what Zend_Date really uses internally.
Well.. a var_dump of Zend_Date is not really helpfull, but you could simply use getIso(). This format has all date informations available:
{code:php}
$date->getIso(); // could return '2009-10-21T15:00:02+01:00'
{code}
Note that using toString and outputting only parts of a date does not show all needed informations. There could be a wrong used timezone, or a DST change which is suppressed by toString() but shown with getIso().
{cloak}