Pārlūkot izejas kodu

fix: Fixes displaying country names which has multiple names listed.

Some countries have multiple names listed in i18n-iso-countries, like US -> ['United States of America', 'USA'].
master
Дамян Минков 4 gadus atpakaļ
vecāks
revīzija
33503122c4

+ 14
- 3
react/features/invite/components/dial-in-summary/web/NumbersList.js Parādīt failu

@@ -66,9 +66,20 @@ class NumbersList extends Component<Props> {
66 66
                 (resultNumbers, number) => {
67 67
                     // The i18n-iso-countries package insists on upper case.
68 68
                     const countryCode = number.countryCode.toUpperCase();
69
-                    const countryName = countryCode === 'SIP'
70
-                        ? t('info.sip')
71
-                        : t(`countries:countries.${countryCode}`);
69
+
70
+                    let countryName;
71
+
72
+                    if (countryCode === 'SIP') {
73
+                        countryName = t('info.sip');
74
+                    } else {
75
+                        countryName = t(`countries:countries.${countryCode}`);
76
+
77
+                        // Some countries have multiple names as US ['United States of America', 'USA']
78
+                        // choose the first one if that is the case
79
+                        if (!countryName) {
80
+                            countryName = t(`countries:countries.${countryCode}.0`);
81
+                        }
82
+                    }
72 83
 
73 84
                     if (resultNumbers[countryName]) {
74 85
                         resultNumbers[countryName].push(number);

Notiek ielāde…
Atcelt
Saglabāt