Skip to content

Commit

Permalink
Sync Locale and LocaleTest with commerceguys/intl.
Browse files Browse the repository at this point in the history
  • Loading branch information
bojanz committed Oct 30, 2021
1 parent fb98dfc commit 9fefc3b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 37 deletions.
69 changes: 34 additions & 35 deletions src/Locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ final class Locale
'en-BS' => 'en-001',
'en-BW' => 'en-001',
'en-BZ' => 'en-001',
'en-CA' => 'en-001',
'en-CC' => 'en-001',
'en-CK' => 'en-001',
'en-CM' => 'en-001',
Expand Down Expand Up @@ -125,7 +124,6 @@ final class Locale
'en-NU' => 'en-001',
'en-NZ' => 'en-001',
'en-PG' => 'en-001',
'en-PH' => 'en-001',
'en-PK' => 'en-001',
'en-PN' => 'en-001',
'en-PW' => 'en-001',
Expand Down Expand Up @@ -197,37 +195,38 @@ final class Locale
'pt-MZ' => 'pt-PT',
'pt-ST' => 'pt-PT',
'pt-TL' => 'pt-PT',
'az-Arab' => 'root',
'az-Cyrl' => 'root',
'blt-Latn' => 'root',
'bs-Cyrl' => 'root',
'byn-Latn' => 'root',
'en-Dsrt' => 'root',
'en-Shaw' => 'root',
'hi-Latn' => 'root',
'iu-Latn' => 'root',
'kk-Arab' => 'root',
'ks-Deva' => 'root',
'ku-Arab' => 'root',
'ky-Arab' => 'root',
'ky-Latn' => 'root',
'ml-Arab' => 'root',
'mn-Mong' => 'root',
'mni-Mtei' => 'root',
'ms-Arab' => 'root',
'pa-Arab' => 'root',
'sat-Deva' => 'root',
'sd-Deva' => 'root',
'sd-Khoj' => 'root',
'sd-Sind' => 'root',
'so-Arab' => 'root',
'sr-Latn' => 'root',
'sw-Arab' => 'root',
'tg-Arab' => 'root',
'uz-Arab' => 'root',
'uz-Cyrl' => 'root',
'yue-Hans' => 'root',
'zh-Hant' => 'root',
'az-Arab' => 'und',
'az-Cyrl' => 'und',
'bal-Latn' => 'und',
'blt-Latn' => 'und',
'bs-Cyrl' => 'und',
'byn-Latn' => 'und',
'en-Dsrt' => 'und',
'en-Shaw' => 'und',
'hi-Latn' => 'und',
'iu-Latn' => 'und',
'kk-Arab' => 'und',
'ks-Deva' => 'und',
'ku-Arab' => 'und',
'ky-Arab' => 'und',
'ky-Latn' => 'und',
'ml-Arab' => 'und',
'mn-Mong' => 'und',
'mni-Mtei' => 'und',
'ms-Arab' => 'und',
'pa-Arab' => 'und',
'sat-Deva' => 'und',
'sd-Deva' => 'und',
'sd-Khoj' => 'und',
'sd-Sind' => 'und',
'so-Arab' => 'und',
'sr-Latn' => 'und',
'sw-Arab' => 'und',
'tg-Arab' => 'und',
'uz-Arab' => 'und',
'uz-Cyrl' => 'und',
'yue-Hans' => 'und',
'zh-Hant' => 'und',
'zh-Hant-MO' => 'zh-Hant-HK',
];

Expand Down Expand Up @@ -402,9 +401,9 @@ public static function getParent($locale)
array_pop($localeParts);
$parent = implode('-', $localeParts);
}
// The library doesn't have data for the empty 'root' locale, it
// The library doesn't have data for the empty 'und' locale, it
// is more user friendly to use the configured fallback instead.
if ($parent == 'root') {
if ($parent == 'und') {
$parent = null;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/LocaleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function testMatchCandidates()
$this->assertTrue(Locale::matchCandidates('de', 'de-AT'));

$this->assertFalse(Locale::matchCandidates('de', 'fr'));
// zh-Hant falls back to "root" instead of "zh".
// zh-Hant falls back to "und" instead of "zh".
$this->assertFalse(Locale::matchCandidates('zh', 'zh-Hant'));
}

Expand Down Expand Up @@ -102,7 +102,7 @@ public function testCandidates()
public function testParent()
{
$this->assertEquals('sr-Latn', Locale::getParent('sr-Latn-RS'));
// sr-Latn falls back to "root" instead of "sr".
// sr-Latn falls back to "und" instead of "sr".
$this->assertEquals(null, Locale::getParent('sr-Latn'));
$this->assertEquals(null, Locale::getParent('sr'));
}
Expand Down

0 comments on commit 9fefc3b

Please sign in to comment.