38 if ($locale !==
null) {
39 $this->localeResolver->setLocale($locale);
68 $currentLocale = $this->localeResolver->getLocale();
69 $locales = \ResourceBundle::getLocales(
'') ?: [];
70 $languages = (
new LanguageBundle())->
get($currentLocale)[
'Languages'];
71 $countries = (
new RegionBundle())->
get($currentLocale)[
'Countries'];
74 $allowedLocales = $this->_config->getAllowedLocales();
76 if (!in_array($locale, $allowedLocales)) {
79 $language = \Locale::getPrimaryLanguage($locale);
80 $country = \Locale::getRegion($locale);
81 if (!$languages[$language] || !$countries[$country]) {
84 if ($translatedName) {
85 $label = ucwords(\Locale::getDisplayLanguage($locale, $locale))
86 .
' (' . \Locale::getDisplayRegion($locale, $locale) .
') / ' 87 . $languages[$language]
88 .
' (' . $countries[$country] .
')';
90 $label = $languages[$language]
91 .
' (' . $countries[$country] .
')';
104 $locale = $this->localeResolver->getLocale();
105 $zones = \DateTimeZone::listIdentifiers(\DateTimeZone::ALL) ?: [];
106 foreach ($zones as
$code) {
108 'label' => \IntlTimeZone::createTimeZone(
$code)
109 ->getDisplayName(
false, \IntlTimeZone::DISPLAY_LONG, $locale) .
' (' .
$code .
')',
123 ->
get($this->localeResolver->getLocale())[
'calendar'][
'gregorian'][
'dayNames'][
'format'][
'wide'] ?: [];
124 $englishDays = (
new DataBundle())->
get(
'en_US')[
'calendar'][
'gregorian'][
'dayNames'][
'format'][
'abbreviated'];
138 $countries = (
new RegionBundle())->
get($this->localeResolver->getLocale())[
'Countries'] ?: [];
150 $currencies = (
new CurrencyBundle())->
get($this->localeResolver->getLocale())[
'Currencies'] ?: [];
152 $allowed = $this->_config->getAllowedCurrencies();
154 if (!in_array(
$code, $allowed)) {
167 $currencyBundle = new \Magento\Framework\Locale\Bundle\CurrencyBundle();
168 $locale = $this->localeResolver->getLocale();
169 $currencies = $currencyBundle->get($locale)[
'Currencies'] ?: [];
201 if ($locale ==
null) {
202 return (
new RegionBundle())->get($this->localeResolver->getLocale())[
'Countries'][
$value];
getOptionWeekdays($preserveCodes=false, $ucFirstCode=false)
getTranslatedOptionLocales()
_getOptionLocales($translatedName=false)
getCountryTranslation($value, $locale=null)
_sortOptionArray($option)
__construct(\Magento\Framework\Locale\ConfigInterface $config, \Magento\Framework\Locale\ResolverInterface $localeResolver, $locale=null)
if(!isset($_GET['name'])) $name