ZF-2256: Possibility to give a string as the source files in the array adapter Zend_Translate_Adapter_Array
Description
It can easily implement by adding 3 lines of code in Zend_Translate_Adapter_Array::_loadTranslationData()
if(!is_array($data)){
$data = include($data);
}
Then the array file should look like :
<?php
return array(
'user_id' => 'Id',
'username' => 'Non utilisateur',
'password' => 'Mot de passe',
'email' => 'Email',
'firstname'=> 'Prénom',
'lastname' => 'Nom',
'created' => 'Crée le',
'modified' => 'Modifié le'
);
Comments
Posted by Thomas Weidner (thomas) on 2007-12-03T13:07:18.000+0000
Why should an Array Adapter accept Strings ?
As per definition of the class name the usage is for "Arrays"... You can simply extend any existing adapter or write your own.
But I don't think that a "string" Adapter is usefull, because you could simply do
Posted by Laurent Melmoux (laurent melmoux) on 2007-12-03T13:56:56.000+0000
Well, if you can do both its even better don't you think? :) There are a lot of classes in the frameworks were the argument is an object or a string, and in the later it will use a factory to get the object. So it could be done with array too.
But best, if you can provide a string the array adapter will work with the automatic source detection. My $0.2
Posted by Thomas Weidner (thomas) on 2007-12-06T07:49:41.000+0000
It's not just that 3 lines. We have also to handle output and failures from the file.
Anyway, it has been integrated with SVN-7050.
Posted by Laurent Melmoux (laurent melmoux) on 2007-12-06T08:09:49.000+0000
Thanks Thomas ! :)
{quote} It's not just that 3 lines We have also to handle output and failures from the file. {quote}
That's right.
I think there is a more appropriated test
Instead of the one I first suggested