瀏覽代碼

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
Дамян Минков 3 年之前
父節點
當前提交
33503122c4
共有 1 個檔案被更改,包括 14 行新增3 行删除
  1. 14
    3
      react/features/invite/components/dial-in-summary/web/NumbersList.js

+ 14
- 3
react/features/invite/components/dial-in-summary/web/NumbersList.js 查看文件

@@ -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);

Loading…
取消
儲存