Permalink
Browse files

Making DEFAULT_LANGUAGE also set $language var which sets Config.lang…

…uage to a correct value. Fixes #228
  • Loading branch information...
1 parent 96fd0bf commit ae4a31f0700deed0af993c8d2b05a305195f1eab @markstory markstory committed Jan 20, 2010
Showing with 6 additions and 1 deletion.
  1. +1 −1 cake/libs/l10n.php
  2. +5 −0 cake/tests/cases/libs/l10n.test.php
View
@@ -352,7 +352,7 @@ function __setLanguage($language = null) {
} else if ($language !== null && isset($this->__l10nCatalog[$language])) {
$langKey = $language;
} else if (defined('DEFAULT_LANGUAGE')) {
- $langKey = DEFAULT_LANGUAGE;
+ $langKey = $language = DEFAULT_LANGUAGE;
}
if ($langKey !== null && isset($this->__l10nCatalog[$langKey])) {
@@ -99,6 +99,11 @@ function testGet() {
$expected = 'en_us';
$this->assertEqual($result, $expected);
+ $l10n->get('es');
+ $l10n->get('');
+ $this->assertEqual($l10n->lang, 'en-us');
+
+
// Using $this->default
$l10n = new L10n();
$l10n->get('use_default');

0 comments on commit ae4a31f

Please sign in to comment.