$resolver->
setDefaults([ 'choice_loader' =>
function DOptions
$options) { if (!
class_exists(Intl::
class)) { throw new LogicException(sprintf('The "symfony/intl" component is required to use "%s". Try running "composer require symfony/intl".',
static::
class));
} $choiceTranslationLocale =
$options['choice_translation_locale'
];
$useAlpha3Codes =
$options['alpha3'
];
$choiceSelfTranslation =
$options['choice_self_translation'
];
return ChoiceList::
loader($this,
new IntlCallbackChoiceLoader(static function D
) use ($choiceTranslationLocale,
$useAlpha3Codes,
$choiceSelfTranslation) { if (true ===
$choiceSelfTranslation) { foreach (Languages::
getLanguageCodes() as $alpha2Code) { try { $languageCode =
$useAlpha3Codes ? Languages::
getAlpha3Code($alpha2Code) :
$alpha2Code;
$languagesList[$languageCode] = Languages::
getName($alpha2Code,
$alpha2Code);
} catch (MissingResourceException
) { // ignore errors like "Couldn't read the indices for the locale 'meta'"
} } } else { $languagesList =
$useAlpha3Codes ? Languages::
getAlpha3Names($choiceTranslationLocale) : Languages::
getNames($choiceTranslationLocale);
}