Skip to content

Commit

Permalink
Remove entries from locales.json incompatible with punic
Browse files Browse the repository at this point in the history
As reported at #20999 the list contains en_US_POSIX as locale but punic is unable to parse such a locale. If you select that locale everyone is confused.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
  • Loading branch information
kesselb committed May 16, 2020
1 parent 703d716 commit 3d85b91
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 4 additions & 4 deletions resources/locales.json
Original file line number Diff line number Diff line change
Expand Up @@ -911,10 +911,6 @@
"code": "en_US",
"name": "English (United States)"
},
{
"code": "en_US_POSIX",
"name": "English (United States, Computer)"
},
{
"code": "en_VC",
"name": "English (St. Vincent & Grenadines)"
Expand Down Expand Up @@ -1399,6 +1395,10 @@
"code": "ga",
"name": "Irish"
},
{
"code": "ga_GB",
"name": "Irish (United Kingdom)"
},
{
"code": "ga_IE",
"name": "Irish (Ireland)"
Expand Down
10 changes: 9 additions & 1 deletion resources/update-locales.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,21 @@
exit(1);
}

$locales = array_map(function (string $localeCode) {
require '../3rdparty/autoload.php';

$locales = array_map(static function (string $localeCode) {
return [
'code' => $localeCode,
'name' => Locale::getDisplayName($localeCode, 'en')
];
}, ResourceBundle::getLocales(''));

$locales = array_filter($locales, static function (array $locale) {
return is_array(Punic\Data::explodeLocale($locale['code']));
});

$locales = array_values($locales);

if (file_put_contents(__DIR__ . '/locales.json', json_encode($locales, JSON_PRETTY_PRINT)) === false) {
echo 'Failed to update locales.json';
exit(1);
Expand Down

0 comments on commit 3d85b91

Please sign in to comment.