Browse files

Fixing catalog() to return 3 char matches

  • Loading branch information...
1 parent 80b1eb4 commit 7bead5df30cebfb8618b93ac538323f0fc8eba6f @phpnut phpnut committed Oct 30, 2009
Showing with 13 additions and 0 deletions.
  1. +2 −0 cake/libs/l10n.php
  2. +11 −0 cake/tests/cases/libs/l10n.test.php
View
2 cake/libs/l10n.php
@@ -474,6 +474,8 @@ function catalog($language = null) {
} else if (is_string($language)) {
if (isset($this->__l10nCatalog[$language])) {
return $this->__l10nCatalog[$language];
+ } else if (isset($this->__l10nMap[$language]) && isset($this->__l10nCatalog[$this->__l10nMap[$language]])) {
+ return $this->__l10nCatalog[$this->__l10nMap[$language]];
}
return false;
}
View
11 cake/tests/cases/libs/l10n.test.php
@@ -981,6 +981,17 @@ function testCatalog() {
'pt-br' => array('language' => 'Portuguese (Brazil)', 'locale' => 'pt_br', 'localeFallback' => 'por', 'charset' => 'utf-8')
);
$this->assertEqual($result, $expected);
+
+ $result = $l10n->catalog(array('eng', 'deu', 'zho', 'rum', 'zul', 'yid'));
+ $expected = array(
+ 'eng' => array('language' => 'English', 'locale' => 'eng', 'localeFallback' => 'eng', 'charset' => 'utf-8'),
+ 'deu' => array('language' => 'German (Standard)', 'locale' => 'deu', 'localeFallback' => 'deu', 'charset' => 'utf-8'),
+ 'zho' => array('language' => 'Chinese', 'locale' => 'chi', 'localeFallback' => 'chi', 'charset' => 'utf-8'),
+ 'rum' => array('language' => 'Romanian', 'locale' => 'rum', 'localeFallback' => 'rum', 'charset' => 'utf-8'),
+ 'zul' => array('language' => 'Zulu', 'locale' => 'zul', 'localeFallback' => 'zul', 'charset' => 'utf-8'),
+ 'yid' => array('language' => 'Yiddish', 'locale' => 'yid', 'localeFallback' => 'yid', 'charset' => 'utf-8')
+ );
+ $this->assertEqual($result, $expected);
}
}
?>

0 comments on commit 7bead5d

Please sign in to comment.