I come up with a solution, the starting point is the locales.
You can get the list of all the locales with getLocales
method. $locales = ResourceBundle::getLocales('');
See here: http://php.net/manual/en/resourcebundle.locales.php
Then you can get the country name of each locale with $countryName = Locale::getDisplayRegion($locale, 'en');
or you can get the language name with Locale::getDisplayLanguage ( $locale )
and so on. See here: http://php.net/manual/en/class.locale.php
For example I managed to match many of the timezone names with the following code;
<?php
/* fill the array with values from
https://gist.github.com/vxnick/380904#gistcomment-1433576
Unfortunately I couldn't manage to find a proper
way to convert countrynames to short codes
*/
$countries = [];
$locales = ResourceBundle::getLocales('');
foreach ($locales as $l => $locale) {
$countryName = Locale::getDisplayRegion($locale, 'en');
$countryCode = array_search($countryName, $countries);
if($countryCode !== false) {
$timezone_identifiers = DateTimeZone::listIdentifiers( DateTimeZone::PER_COUNTRY, $countryCode);
echo "----------------".PHP_EOL;
echo $countryName.PHP_EOL;
echo Locale::getDisplayLanguage ( $locale ).PHP_EOL;
var_dump($timezone_identifiers);
}
}
I know this is not the best answer but at least this may give you a kick start.
Update
To get country name per locale you can try this one;
<?php
$locales = ResourceBundle::getLocales('');
foreach ($locales as $l => $locale) {
$countryName = Locale::getDisplayRegion($locale, 'en');
echo $locale."===>".$countryName.PHP_EOL;
}
Update 2
Gather day names, month names, currency per locale
$locales = ResourceBundle::getLocales('');
foreach ($locales as $l => $locale) {
echo "============= ".PHP_EOL;
echo "Locale:". $locale. PHP_EOL;
echo "Language: ".Locale::getDisplayLanguage($locale, 'en');
echo PHP_EOL;
$formatter = new NumberFormatter($locale, NumberFormatter::CURRENCY);
echo "Currency: ".$formatter->getTextAttribute(NumberFormatter::CURRENCY_CODE);
echo PHP_EOL;
echo PHP_EOL."Days :".PHP_EOL;
$dt = new DateTime('this sunday');
for($i = 0; $i<=6; $i++) {
echo IntlDateFormatter::formatObject($dt, "eeee", $locale);
$dt->add(new DateInterval('P1D'));
echo PHP_EOL;
}
echo PHP_EOL."Months :".PHP_EOL;
$dt = new DateTime('01/01/2015');
for($i = 0; $i<12; $i++) {
echo IntlDateFormatter::formatObject($dt, "MMMM", $locale);
$dt->add(new DateInterval('P1M'));
echo PHP_EOL;
}
}
As far as I read on the docs, user has to gather the per locale information with methods like above. There's a library which can be beneficial for this purposes. https://github.com/ICanBoogie/CLDR