} private function generateLocaleName(BundleEntryReaderInterface
$reader, string
$tempDir, string
$locale, string
$displayLocale, string
$pattern, string
$separator): string
{ // Apply generic notation using square brackets as described per http://cldr.unicode.org/translation/language-names
$name =
str_replace(['(', ')'
],
['[', ']'
],
$reader->
readEntry($tempDir.'/lang',
$displayLocale,
['Languages', \Locale::
getPrimaryLanguage($locale)]));
$extras =
[];
// 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]));
}