diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2020-05-16 23:21:22 +0200 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2020-05-16 23:21:22 +0200 |
commit | 3d85b91a3cca891f52bea1f16d298e2204c499ee (patch) | |
tree | 72dfd511660dc3c1b3f642dde1f23cb137b09c1b /resources/update-locales.php | |
parent | 703d716a32e08d0bc594ba5572452044c5fb3022 (diff) | |
download | nextcloud-server-3d85b91a3cca891f52bea1f16d298e2204c499ee.tar.gz nextcloud-server-3d85b91a3cca891f52bea1f16d298e2204c499ee.zip |
Remove entries from locales.json incompatible with punic
As reported at https://github.com/nextcloud/server/issues/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>
Diffstat (limited to 'resources/update-locales.php')
-rwxr-xr-x | resources/update-locales.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/resources/update-locales.php b/resources/update-locales.php index d5addd0a9ae..50d848c76a6 100755 --- a/resources/update-locales.php +++ b/resources/update-locales.php @@ -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); |