How can I make all i18n-aware components aware of my Zend_Translate object?
A variety of components are are translation aware (i.e., accept Zend_Translate objects), including:
- Zend_View_Helper_Translate
- Zend_Validate_*
- Zend_Form
To have them all use the same Zend_Translate instance, simply place it in the registry with the key "Zend_Translate":
How can I use the same locale everywhere?
With ZF 1.7 an application wide locale is supported. You can do the following in your bootstrap file:
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.
Why are my dates formatted wrong? Why do I get the false year value?
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:
Note the lower cased "y" which makes the difference and outputs the real year.