aboutsummaryrefslogtreecommitdiffstats
path: root/resources/update-locales.php
diff options
context:
space:
mode:
Diffstat (limited to 'resources/update-locales.php')
-rwxr-xr-xresources/update-locales.php10
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);