// Discover the name of the script part of the locale
// i.e. in zh_Hans_MO, "Hans" is the script
if ($script = \Locale::
getScript($locale)) { $extras[] =
str_replace(['(', ')'
],
['[', ']'
],
$reader->
readEntry($tempDir.'/lang',
$displayLocale,
['Scripts',
$script]));
} // Discover the name of the region part of the locale
// i.e. in de_AT, "AT" is the region
if ($region = \Locale::
getRegion($locale)) { if (ctype_alpha($region) && !RegionDataGenerator::
isValidCountryCode($region)) { throw new MissingResourceException(sprintf('Skipping "%s" due an invalid country.',
$locale));
} $extras[] =
str_replace(['(', ')'
],
['[', ']'
],
$reader->
readEntry($tempDir.'/region',
$displayLocale,
['Countries',
$region]));
} if ($extras) { $extra =
array_shift($extras);
foreach ($extras as $part) { $extra =
str_replace(['{0}', '{1}'
],
[$extra,
$part],
$separator);
}