diff options
author | Mario <mario@mariovavti.com> | 2020-06-15 07:01:35 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2020-06-15 07:01:35 +0000 |
commit | 63a6b4a162041d8381c9e58c641b44ec5120011a (patch) | |
tree | 73386c5a5349ed5eec8bd165f68d47a6b60c6639 /vendor/commerceguys/intl/scripts/generate_currency_data.php | |
parent | 7270da6a28f836f94f6d98557df9532e587c3646 (diff) | |
download | volse-hubzilla-63a6b4a162041d8381c9e58c641b44ec5120011a.tar.gz volse-hubzilla-63a6b4a162041d8381c9e58c641b44ec5120011a.tar.bz2 volse-hubzilla-63a6b4a162041d8381c9e58c641b44ec5120011a.zip |
composer update commerceguys/intl
Diffstat (limited to 'vendor/commerceguys/intl/scripts/generate_currency_data.php')
-rw-r--r-- | vendor/commerceguys/intl/scripts/generate_currency_data.php | 80 |
1 files changed, 2 insertions, 78 deletions
diff --git a/vendor/commerceguys/intl/scripts/generate_currency_data.php b/vendor/commerceguys/intl/scripts/generate_currency_data.php index 9dfc262e1..22c33c63b 100644 --- a/vendor/commerceguys/intl/scripts/generate_currency_data.php +++ b/vendor/commerceguys/intl/scripts/generate_currency_data.php @@ -7,38 +7,7 @@ * deprecated currencies, unlike CLDR (v25 has 139 deprecated entries). */ -set_time_limit(0); -require __DIR__ . '/../vendor/autoload.php'; - -// Downloaded from http://www.currency-iso.org/en/home/tables/table-a1.html -$isoCurrencies = __DIR__ . '/assets/c2.xml'; -// Downloaded from https://github.com/unicode-cldr/cldr-numbers-full.git -$numbersDirectory = __DIR__ . '/assets/cldr-numbers-full/main/'; -$cldrCurrencies = $numbersDirectory . 'en/currencies.json'; -// Downloaded from https://github.com/unicode-cldr/cldr-core.git -$currencyData = __DIR__ . '/assets/cldr-core/supplemental/currencyData.json'; -// Downloaded from https://github.com/unicode-cldr/cldr-localenames-full.git -$localeDirectory = __DIR__ . '/assets/cldr-localenames-full/main/'; -if (!file_exists($isoCurrencies)) { - die("The $isoCurrencies file was not found"); -} -if (!file_exists($cldrCurrencies)) { - die("The $cldrCurrencies file was not found"); -} -if (!file_exists($currencyData)) { - die("The $currencyData file was not found"); -} -if (!function_exists('collator_create')) { - // Reimplementing intl's collator would be a huge undertaking, so we - // use it instead to presort the generated locale specific data. - die('The intl extension was not found.'); -} -if (!is_dir($localeDirectory)) { - die("The $localeDirectory directory was not found"); -} -if (!is_dir($numbersDirectory)) { - die("The $numbersDirectory directory was not found"); -} +require __DIR__ . '/generate_base.php'; $currencyData = json_decode(file_get_contents($currencyData), true); $isoData = simplexml_load_file($isoCurrencies); @@ -76,17 +45,6 @@ file_put_contents(__DIR__ . '/currency_data.php', $data); echo "Done.\n"; /** - * Converts the provided data into json and writes it to the disk. - */ -function file_put_json($filename, $data) -{ - $data = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); - // Indenting with tabs instead of 4 spaces gives us 20% smaller files. - $data = str_replace(' ', "\t", $data); - file_put_contents($filename, $data); -} - -/** * Exports base data. */ function export_base_data($baseData) @@ -213,6 +171,7 @@ function generate_localizations(array $baseData) return $localizations; } + /** * Filters out duplicate localizations (same as their parent locale). * @@ -242,38 +201,3 @@ function filter_duplicate_localizations(array $localizations) return $localizations; } - -/** - * Creates a list of available locales. - */ -function discover_locales() -{ - global $localeDirectory; - - // Locales listed without a "-" match all variants. - // Locales listed with a "-" match only those exact ones. - $ignoredLocales = [ - // Interlingua is a made up language. - 'ia', - // Valencian differs from its parent only by a single character (è/é). - 'ca-ES-VALENCIA', - // Special "grouping" locales. - 'root', 'en-US-POSIX', - ]; - - // Gather available locales. - $locales = []; - if ($handle = opendir($localeDirectory)) { - while (false !== ($entry = readdir($handle))) { - if (substr($entry, 0, 1) != '.') { - $entryParts = explode('-', $entry); - if (!in_array($entry, $ignoredLocales) && !in_array($entryParts[0], $ignoredLocales)) { - $locales[] = $entry; - } - } - } - closedir($handle); - } - - return $locales; -} |