Skip to content
This repository has been archived by the owner on May 16, 2018. It is now read-only.

Commit

Permalink
Fixes #516 - Zend_Locale does not honor parentLocale configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
froschdesign committed May 19, 2015
1 parent ccc4509 commit 116681b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions library/Zend/Locale/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ private static function _getFile($locale, $path, $attribute = false, $value = fa
// 3. -> zh
// 4. -> root
if (($locale != 'root') && ($result)) {
// Search for parent locale
if (false !== strpos($locale, '_')) {
$parentLocale = self::getContent($locale, 'parentlocale');
if ($parentLocale) {
$temp = self::_getFile($parentLocale, $path, $attribute, $value, $temp);
}
}

$locale = substr($locale, 0, -strlen(strrchr($locale, '_')));
if (!empty($locale)) {
$temp = self::_getFile($locale, $path, $attribute, $value, $temp);
Expand Down
9 changes: 9 additions & 0 deletions tests/Zend/Locale/DataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7282,4 +7282,13 @@ public function testGetParentLocale()
$result = Zend_Locale_Data::getContent('de_DE', 'parentlocale');
$this->assertFalse($result);
}

/**
* @group GH-516
*/
public function testLocaleWhichHasParentLocale()
{
$result = Zend_Locale_Data::getContent('en_HK', 'nametocurrency', 'XAF');
$this->assertEquals('Central African CFA Franc', $result);
}
}

0 comments on commit 116681b

Please sign in to comment.