Skip to content
Snippets Groups Projects
Unverified Commit 0a21f0f2 authored by Morris Jobke's avatar Morris Jobke Committed by GitHub
Browse files

Merge pull request #21003 from nextcloud/enh/noid/validate-locale

Remove entries from locales.json incompatible with punic
parents 72cd1463 3d85b91a
No related branches found
No related tags found
No related merge requests found
......@@ -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)"
......@@ -1399,6 +1395,10 @@
"code": "ga",
"name": "Irish"
},
{
"code": "ga_GB",
"name": "Irish (United Kingdom)"
},
{
"code": "ga_IE",
"name": "Irish (Ireland)"
......
......@@ -29,13 +29,21 @@ if (!extension_loaded('intl')) {
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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment