Permalink
Browse files

Add new syntax more user friendly

Add new syntax more user friendly
  • Loading branch information...
1 parent 2e1a974 commit 356ba96f69f22f087139872f019d561a0333251b @blanchonvincent blanchonvincent committed Oct 8, 2012
Showing with 12 additions and 3 deletions.
  1. +12 −3 library/Zend/I18n/Translator/Loader/Ini.php
@@ -47,11 +47,20 @@ public function load($locale, $filename)
$messagesNamespaced = $iniReader->fromFile($filename);
$list = $messagesNamespaced;
- if(isset($messagesNamespaced['translate'])) {
- $list = $messagesNamespaced['translate'];
+ if(isset($messagesNamespaced['translation'])) {
+ $list = $messagesNamespaced['translation'];
}
foreach($list as $message) {
- $messages[$message['message']] = $message['translate'];
+ if(!is_array($message) || count($message) < 2) {
+ throw new Exception\InvalidArgumentException(
+ 'Each INI row must be an array with message and translation'
+ );
+ }
+ if(isset($message['message']) && isset($message['translation'])) {
+ $messages[$message['message']] = $message['translation'];
+ } else {
+ $messages[array_shift($message)] = array_shift($message);
+ }
}
if (!is_array($messages)) {

0 comments on commit 356ba96

Please sign in to comment.