Skip to content

Commit a4f6b3c

Browse files
committed
Fix #12256 #13263 - add Serbian Latin language and change language lists to show script
1 parent f35c6eb commit a4f6b3c

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

lib/internal/Magento/Framework/Locale/Config.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ class Config implements \Magento\Framework\Locale\ConfigInterface
9191
'sk_SK', /*Slovak (Slovakia)*/
9292
'sl_SI', /*Slovenian (Slovenia)*/
9393
'sq_AL', /*Albanian (Albania)*/
94-
'sr_Cyrl_RS', /*Serbian (Serbia)*/
94+
'sr_Cyrl_RS', /*Serbian (Cyrillic, Serbia)*/
95+
'sr_Latn_RS', /*Serbian (Latin, Serbia)*/
9596
'sv_SE', /*Swedish (Sweden)*/
9697
'sv_FI', /*Swedish (Finland)*/
9798
'sw_KE', /*Swahili (Kenya)*/

lib/internal/Magento/Framework/Locale/Test/Unit/ConfigTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ConfigTest extends \PHPUnit\Framework\TestCase
1515
'es_MX', 'eu_ES', 'es_PE', 'et_EE', 'fa_IR', 'fi_FI', 'fil_PH', 'fr_CA', 'fr_FR', 'gu_IN',
1616
'he_IL', 'hi_IN', 'hr_HR', 'hu_HU', 'id_ID', 'is_IS', 'it_CH', 'it_IT', 'ja_JP', 'ka_GE',
1717
'km_KH', 'ko_KR', 'lo_LA', 'lt_LT', 'lv_LV', 'mk_MK', 'mn_Cyrl_MN', 'ms_Latn_MY', 'nl_NL', 'nb_NO',
18-
'nn_NO', 'pl_PL', 'pt_BR', 'pt_PT', 'ro_RO', 'ru_RU', 'sk_SK', 'sl_SI', 'sq_AL', 'sr_Cyrl_RS',
18+
'nn_NO', 'pl_PL', 'pt_BR', 'pt_PT', 'ro_RO', 'ru_RU', 'sk_SK', 'sl_SI', 'sq_AL', 'sr_Cyrl_RS', 'sr_Latn_RS',
1919
'sv_SE', 'sw_KE', 'th_TH', 'tr_TR', 'uk_UA', 'vi_VN', 'zh_Hans_CN', 'zh_Hant_HK', 'zh_Hant_TW', 'es_CL',
2020
'lo_LA', 'es_VE', 'en_IE',
2121
];

lib/internal/Magento/Framework/Locale/TranslatedLists.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,23 @@ protected function _getOptionLocales($translatedName = false)
8181
}
8282
$language = \Locale::getPrimaryLanguage($locale);
8383
$country = \Locale::getRegion($locale);
84+
$script = \Locale::getScript($locale);
85+
$scriptTranslated = '';
8486
if (!$languages[$language] || !$countries[$country]) {
8587
continue;
8688
}
89+
if ($script !== '') {
90+
$script = \Locale::getDisplayScript($locale) . ', ';
91+
$scriptTranslated = \Locale::getDisplayScript($locale, $locale) . ', ';
92+
}
8793
if ($translatedName) {
8894
$label = ucwords(\Locale::getDisplayLanguage($locale, $locale))
89-
. ' (' . \Locale::getDisplayRegion($locale, $locale) . ') / '
95+
. ' (' . $scriptTranslated . \Locale::getDisplayRegion($locale, $locale) . ') / '
9096
. $languages[$language]
91-
. ' (' . $countries[$country] . ')';
97+
. ' (' . $script . $countries[$country] . ')';
9298
} else {
9399
$label = $languages[$language]
94-
. ' (' . $countries[$country] . ')';
100+
. ' (' . $script . $countries[$country] . ')';
95101
}
96102
$options[] = ['value' => $locale, 'label' => $label];
97103
}

lib/internal/Magento/Framework/Setup/Lists.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,14 @@ public function getLocaleList()
9999
}
100100
$language = \Locale::getPrimaryLanguage($locale);
101101
$country = \Locale::getRegion($locale);
102+
$script = \Locale::getScript($locale);
102103
if (!$languages[$language] || !$countries[$country]) {
103104
continue;
104105
}
105-
$list[$locale] = $languages[$language] . ' (' . $countries[$country] . ')';
106+
if ($script !== '') {
107+
$script = \Locale::getDisplayScript($locale) . ', ';
108+
}
109+
$list[$locale] = $languages[$language] . ' (' . $script . $countries[$country] . ')';
106110
}
107111
asort($list);
108112
return $list;

0 commit comments

Comments
 (0)