Hy interested ones,
This is my third entry for Zend_Translate this week. Maybe I should call it “Zend_Translate“-week. :-)
Ok… so what have I done this time.
I reworked Zend_Translate a little bit. Now it supports Zend_Config and additionally all options can be given as array.
The change seems small but makes coding a little bit easier and more comfortable.
Previously you had to do:
new Zend_Translate('csv', '\path\to\myfile.csv', null, array('delimiter' => ':'));
Now you can do:
new Zend_Translate( array( 'adapter' => 'csv', 'content' => '\path\to\myfile.csv', 'delimiter' => ':' ) );
By using the array syntax the code is much more readable and seems more logical.
Of course you can also use a Zend_Config object instead of an array.
This syntax is also supported by using addTranslation(), but as you call addTranslation() on the adapter, you can’t change the adapter within this method so it will be ignored in that case.
$translate->addTranslation( array( 'content' => '\path\to\translations\', 'locale' => 'de', 'scan' => Zend_Translate::LOCALE_DIRECTORY ) );
Note that this new feature is available as with ZF 1.10.3.
Of course the old syntax is still supported. So your old code works without that it has to be reworked (when you don’t like to do that).
When you find this feature useful, feel free to use it yourself. :-)
I18N Team Leader, Zend Framework
Zend Framework Advisory Board Member
Zend Certified Engineer for Zend Framework