Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 116681b

Browse files
committed
Fixes zendframework#516 - Zend_Locale does not honor parentLocale configuration
1 parent ccc4509 commit 116681b

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

library/Zend/Locale/Data.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,14 @@ private static function _getFile($locale, $path, $attribute = false, $value = fa
241241
// 3. -> zh
242242
// 4. -> root
243243
if (($locale != 'root') && ($result)) {
244+
// Search for parent locale
245+
if (false !== strpos($locale, '_')) {
246+
$parentLocale = self::getContent($locale, 'parentlocale');
247+
if ($parentLocale) {
248+
$temp = self::_getFile($parentLocale, $path, $attribute, $value, $temp);
249+
}
250+
}
251+
244252
$locale = substr($locale, 0, -strlen(strrchr($locale, '_')));
245253
if (!empty($locale)) {
246254
$temp = self::_getFile($locale, $path, $attribute, $value, $temp);

tests/Zend/Locale/DataTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7282,4 +7282,13 @@ public function testGetParentLocale()
72827282
$result = Zend_Locale_Data::getContent('de_DE', 'parentlocale');
72837283
$this->assertFalse($result);
72847284
}
7285+
7286+
/**
7287+
* @group GH-516
7288+
*/
7289+
public function testLocaleWhichHasParentLocale()
7290+
{
7291+
$result = Zend_Locale_Data::getContent('en_HK', 'nametocurrency', 'XAF');
7292+
$this->assertEquals('Central African CFA Franc', $result);
7293+
}
72857294
}

0 commit comments

Comments
 (0)