Browse Source

chore(admin-ui): Generate json report for i18n coverage

Michael Bromley 5 years ago
parent
commit
9e5932f836

+ 4 - 0
packages/admin-ui/README.md

@@ -42,4 +42,8 @@ Extracting translation tokens for "src\lib\static\i18n-messages\de.json"
 de: 592 of 650 tokens translated (91%)
 ```
 
+This report data is also saved to the [i18n-coverage.json](./i18n-coverage.json) file.
+
 To add support for a new language, create a new empty json file (`{}`) in the `i18n-messages` directory named `<languageCode>.json`, where `languageCode` is one of the supported codes as given in the [LanguageCode enum type](../core/src/api/schema/common/language-code.graphql), then run `yarn extract-translations`
+
+

+ 36 - 0
packages/admin-ui/i18n-coverage.json

@@ -0,0 +1,36 @@
+{
+  "generatedOn": "2020-06-03T07:52:45.859Z",
+  "lastCommit": "201e7f8e8a821549059d7e0d2492f0ea1bd6996c",
+  "translationStatus": {
+    "de": {
+      "tokenCount": 650,
+      "translatedCount": 609,
+      "percentage": 94
+    },
+    "en": {
+      "tokenCount": 650,
+      "translatedCount": 650,
+      "percentage": 100
+    },
+    "es": {
+      "tokenCount": 650,
+      "translatedCount": 333,
+      "percentage": 51
+    },
+    "pl": {
+      "tokenCount": 650,
+      "translatedCount": 566,
+      "percentage": 87
+    },
+    "zh_Hans": {
+      "tokenCount": 650,
+      "translatedCount": 548,
+      "percentage": 84
+    },
+    "zh_Hant": {
+      "tokenCount": 650,
+      "translatedCount": 548,
+      "percentage": 84
+    }
+  }
+}

+ 27 - 0
packages/admin-ui/scripts/extract-translations.js

@@ -1,6 +1,7 @@
 const path = require('path');
 const fs = require('fs-extra');
 const spawn = require('cross-spawn');
+const { exec } = require('child_process');
 
 const MESSAGES_DIR = path.join(__dirname, '../src/lib/static/i18n-messages');
 
@@ -14,8 +15,16 @@ extractTranslations().then(
     },
 );
 
+/**
+ * Extracts translation tokens into the i18n-messages files found in the MESSAGES_DIR.
+ */
 async function extractTranslations() {
     const locales = fs.readdirSync(MESSAGES_DIR).map((file) => path.basename(file).replace('.json', ''));
+    const report = {
+        generatedOn: new Date().toISOString(),
+        lastCommit: await getLastGitCommitHash(),
+        translationStatus: {},
+    };
     for (const locale of locales) {
         const outputPath = path.join(
             path.relative(path.join(__dirname, '..'), MESSAGES_DIR),
@@ -28,10 +37,16 @@ async function extractTranslations() {
             const { tokenCount, translatedCount, percentage } = getStatsForLocale(locale);
             console.log(`${locale}: ${translatedCount} of ${tokenCount} tokens translated (${percentage}%)`);
             console.log('');
+
+            report.translationStatus[locale] = { tokenCount, translatedCount, percentage };
         } catch (e) {
             console.log(e);
         }
     }
+
+    const reportFile = path.join(__dirname, '../i18n-coverage.json');
+    fs.writeFileSync(reportFile, JSON.stringify(report, null, 2), 'utf-8');
+    console.log(`Report saved to "${reportFile}"`);
 }
 
 function runExtraction(locale) {
@@ -86,3 +101,15 @@ function getNgxTranslateExtractCommand(locale) {
         `_`,
     ];
 }
+
+function getLastGitCommitHash() {
+    return new Promise((resolve, reject) => {
+        exec('git rev-parse HEAD', (err, result) => {
+            if (err) {
+                reject(err);
+            } else {
+                resolve(result.replace('\n', ''));
+            }
+        });
+    });
+}

+ 1 - 1
packages/admin-ui/src/lib/static/i18n-messages/de.json

@@ -679,4 +679,4 @@
     "job-result": "Job-Ergebnis",
     "job-state": "Job-Status"
   }
-}
+}

+ 109 - 62
packages/admin-ui/src/lib/static/i18n-messages/zh_TW.json → packages/admin-ui/src/lib/static/i18n-messages/zh_Hant.json

@@ -21,7 +21,8 @@
     "update-focal-point": "更新焦点",
     "update-focal-point-error": "更新焦點失敗",
     "update-focal-point-success": "更新焦點成功",
-    "upload-assets": "上傳檔案"
+    "upload-assets": "上傳檔案",
+    "uploading": ""
   },
   "breadcrumb": {
     "administrators": "用户管理",
@@ -29,10 +30,12 @@
     "channels": "鎖售渠道",
     "collections": "商品系列",
     "countries": "國家",
+    "customer-groups": "",
     "customers": "客户管理",
     "dashboard": "總覽",
     "facets": "商品特徵",
     "global-settings": "語言",
+    "job-queue": "",
     "manage-variants": "商品規格管理",
     "orders": "訂單管理",
     "payment-methods": "支付方式",
@@ -40,8 +43,10 @@
     "promotions": "優惠",
     "roles": "角色管理",
     "shipping-methods": "配送方式管理",
+    "system-status": "",
     "tax-categories": "稅項類別",
-    "tax-rates": "税率"
+    "tax-rates": "税率",
+    "zones": ""
   },
   "catalog": {
     "add-facet-value": "新增特徵值",
@@ -55,16 +60,19 @@
     "collection-contents": "系列產品",
     "confirm-adding-options-delete-default-body": "新增規格到此產品會引致包含此規格的產品被移除,確認繼續吗?",
     "confirm-adding-options-delete-default-title": "確認移除產品規格嗎?",
+    "confirm-delete-asset": "",
     "confirm-delete-channel": "確認移除渠道?",
     "confirm-delete-collection": "確認移除商品系列吗?",
     "confirm-delete-collection-and-children-body": "移除這個系列會移除它所包含的子系列,確認移除嗎?",
     "confirm-delete-country": "確認移除此國家?",
+    "confirm-delete-customer": "",
     "confirm-delete-facet": "確認移除此特徵?",
     "confirm-delete-facet-value": "確認移除特徵值?",
     "confirm-delete-product": "確認移除商品?",
     "confirm-delete-product-variant": "確認移除商品規格?",
     "confirm-delete-promotion": "確認移除優惠券?",
     "confirm-delete-shipping-method": "確認移除此郵寄方式?",
+    "confirm-delete-zone": "",
     "create-new-collection": "新增系列",
     "create-new-facet": "新增特徵",
     "create-new-product": "新增商品",
@@ -112,7 +120,6 @@
     "search-product-name-or-code": "輸入要搜索的商品名稱或商品編碼",
     "sku": "商品庫存編碼",
     "slug": "名稱缩写",
-    "slug-pattern-error": "只能使用字母, 數字, - and _",
     "stock-on-hand": "庫存",
     "tax-category": "税表分類",
     "taxes": "價格(連税)",
@@ -127,25 +134,31 @@
     "ID": "ID",
     "actions": "操作",
     "add-new-variants": "新增{count}個商品規格",
+    "add-note": "",
     "available-languages": "可用語言",
     "cancel": "取消",
     "cancel-navigation": "取消",
     "channel": "渠道",
     "channels": "渠道",
     "code": "編碼",
+    "confirm": "",
+    "confirm-delete-note": "",
     "confirm-navigation": "導航確認",
     "create": "新增",
     "created-at": "建立時間",
     "custom-fields": "客戶自訂欄位",
     "default-channel": "默認渠道",
+    "default-language": "",
     "delete": "移除",
     "description": "描述",
+    "details": "",
     "disabled": "禁用",
     "discard-changes": "放弃修改",
     "display-custom-fields": "顯示客戶自訂欄位",
     "done": "完成",
     "edit": "編辑",
     "edit-field": "編辑域",
+    "edit-note": "",
     "enabled": "启用",
     "extension-running-in-separate-window": "扩展已在另一個窗口启動",
     "guest": "游客",
@@ -153,6 +166,7 @@
     "items-per-page-option": "每页顯示 { count } 條",
     "language": "語言",
     "launch-extension": "启動扩展插件",
+    "live-update": "",
     "log-out": "退出",
     "login": "登陆",
     "more": "更多...",
@@ -184,14 +198,27 @@
     "updated-at": "修改時間",
     "username": "用户名",
     "view-next-month": "查看下個月",
-    "view-previous-month": "查看上個月"
+    "view-previous-month": "查看上個月",
+    "with-selected": ""
   },
   "customer": {
+    "add-customer-to-group": "",
+    "add-customer-to-groups-with-count": "",
+    "add-customers-to-group": "",
+    "add-customers-to-group-success": "",
+    "add-customers-to-group-with-count": "",
+    "add-customers-to-group-with-name": "",
     "addresses": "地址",
     "city": "市",
+    "confirm-delete-customer-group": "",
+    "confirm-remove-customer-from-group": "",
     "country": "國家",
+    "create-customer-group": "",
     "create-new-address": "新增地址",
     "create-new-customer": "新增客户",
+    "create-new-customer-group": "",
+    "customer-groups": "",
+    "customer-history": "",
     "customer-type": "客户驗證類型",
     "default-billing-address": "默認賬單地址",
     "default-shipping-address": "默認郵寄地址",
@@ -200,24 +227,51 @@
     "first-name": "名",
     "full-name": "名字",
     "guest": "訪客",
+    "history-customer-added-to-group": "",
+    "history-customer-address-created": "",
+    "history-customer-address-deleted": "",
+    "history-customer-address-updated": "",
+    "history-customer-detail-updated": "",
+    "history-customer-email-update-requested": "",
+    "history-customer-email-update-verified": "",
+    "history-customer-password-reset-requested": "",
+    "history-customer-password-reset-verified": "",
+    "history-customer-password-updated": "",
+    "history-customer-registered": "",
+    "history-customer-removed-from-group": "",
+    "history-customer-verified": "",
     "last-name": "姓",
     "name": "姓名",
+    "new-email-address": "",
     "no-orders-placed": "無訂單記錄",
+    "not-a-member-of-any-groups": "",
+    "old-email-address": "",
     "orders": "訂單列表",
     "password": "密碼",
     "phone-number": "電话號碼",
     "postal-code": "郵政編碼",
     "province": "省(直轄市)",
     "registered": "已注册",
+    "remove-customers-from-group-success": "",
+    "remove-from-group": "",
     "search-customers-by-email": "輸入要搜索的客户電郵地址",
     "set-as-default-billing-address": "設定為默認賬單地址",
     "set-as-default-shipping-address": "設定為默認郵寄地址",
     "street-line-1": "街道",
     "street-line-2": "詳细地址(小區,公司門牌號等)",
     "title": "客户稱謂",
-    "verified": "已驗證"
+    "update-customer-group": "",
+    "verified": "已驗證",
+    "view-group-members": ""
   },
   "datetime": {
+    "ago-days": "",
+    "ago-hours": "",
+    "ago-minutes": "",
+    "ago-seconds": "",
+    "duration-milliseconds": "",
+    "duration-minutes:seconds": "",
+    "duration-seconds": "",
     "month-apr": "4月",
     "month-aug": "8月",
     "month-dec": "12月",
@@ -253,29 +307,20 @@
     "403-forbidden": "無權限存取路徑 \"{ path }\"。無權限或會話已經逾期,請重新登入",
     "could-not-connect-to-server": "無法連接伺服器 { url }",
     "facet-value-form-values-do-not-match": "表單中商品特徵值數量與實際不符",
+    "health-check-failed": "",
+    "no-default-shipping-zone-set": "",
+    "no-default-tax-zone-set": "",
     "product-variant-form-values-do-not-match": "表單中商品規格數量與實際不符"
   },
-  "job": {
-    "reindex": "重建索引"
-  },
   "lang": {
-    "aa": "阿法爾文",
-    "ab": "阿布哈茲文",
-    "ae": "阿維斯陀文",
     "af": "南非文",
     "ak": "阿坎文",
     "am": "阿姆哈拉文",
-    "an": "阿拉頁文",
     "ar": "阿拉伯文",
     "as": "阿薩姆文",
-    "av": "阿瓦爾文",
-    "ay": "艾馬拉文",
     "az": "阿塞拜疆文",
-    "ba": "巴什基爾文",
     "be": "白俄羅斯文",
     "bg": "保加利亞文",
-    "bh": "比哈爾文",
-    "bi": "比斯拉馬文",
     "bm": "班巴拉文",
     "bn": "孟加拉文",
     "bo": "藏文",
@@ -283,84 +328,77 @@
     "bs": "波斯尼亞文",
     "ca": "加泰羅尼亞文",
     "ce": "車臣文",
-    "ch": "查莫羅文",
     "co": "柯西嘉文",
-    "cr": "克里文",
     "cs": "捷克文",
     "cu": "古教會斯拉夫文",
-    "cv": "楚瓦什文",
     "cy": "威爾士文",
     "da": "丹麥文",
     "de": "德文",
-    "dv": "迪維西文",
+    "de_AT": "",
+    "de_CH": "",
     "dz": "宗喀文",
     "ee": "埃維文",
     "el": "希臘文",
     "en": "英文",
+    "en_AU": "",
+    "en_CA": "",
+    "en_GB": "",
+    "en_US": "",
     "eo": "世界文",
     "es": "西班牙文",
+    "es_ES": "",
+    "es_MX": "",
     "et": "愛沙尼亞文",
     "eu": "巴斯克文",
     "fa": "波斯文",
+    "fa_AF": "",
     "ff": "富拉文",
     "fi": "芬蘭文",
-    "fj": "斐濟文",
     "fo": "法羅文",
     "fr": "法文",
+    "fr_CA": "",
+    "fr_CH": "",
     "fy": "西弗里斯蘭文",
     "ga": "愛爾蘭文",
     "gd": "蘇格蘭盖爾文",
     "gl": "加利西亞文",
-    "gn": "瓜拉尼文",
     "gu": "古吉拉特文",
     "gv": "馬恩文",
     "ha": "豪薩文",
     "he": "希伯来文",
     "hi": "印地文",
-    "ho": "希里莫圖文",
     "hr": "克羅地亞文",
     "ht": "海地文",
     "hu": "匈牙利文",
     "hy": "亞美尼亞文",
-    "hz": "赫雷羅文",
     "ia": "國際文",
     "id": "印度尼西亞文",
-    "ie": "西方國際文",
     "ig": "伊博文",
     "ii": "彝文北部方言",
-    "ik": "伊努皮克文",
-    "io": "伊多文",
     "is": "冰島文",
     "it": "意大利文",
-    "iu": "因紐特文",
     "ja": "日文",
     "jv": "爪哇文",
     "ka": "格鲁吉亞文",
-    "kg": "剛果文",
     "ki": "基庫尤文",
-    "kj": "庫瓦亞馬文",
     "kk": "哈薩克文",
     "kl": "格陵蘭文",
     "km": "高棉文",
     "kn": "坎納達文",
     "ko": "韓文",
-    "kr": "卡努里文",
     "ks": "克什米爾文",
     "ku": "庫爾德文",
-    "kv": "科米文",
     "kw": "康沃爾文",
     "ky": "柯爾克孜文",
     "la": "拉丁文",
     "lb": "盧森堡文",
     "lg": "干達文",
-    "li": "林堡文",
     "ln": "林加拉文",
     "lo": "老撾文",
     "lt": "立陶宛文",
     "lu": "盧巴卡丹加文",
     "lv": "拉脱維亞文",
     "mg": "馬達加斯加文",
-    "mh": "馬紹爾文",
     "mi": "毛利文",
     "mk": "馬其頓文",
     "ml": "馬拉雅拉姆文",
@@ -369,35 +407,30 @@
     "ms": "馬来文",
     "mt": "馬耳他文",
     "my": "緬甸文",
-    "na": "瑙鲁文",
     "nb": "書面挪威文",
     "nd": "北恩德貝莱文",
     "ne": "尼泊爾文",
-    "ng": "恩敦加文",
     "nl": "荷蘭文",
+    "nl_BE": "",
     "nn": "挪威尼諾斯克文",
-    "no": "挪威文",
-    "nr": "南恩德貝莱文",
-    "nv": "納瓦霍文",
     "ny": "齊切瓦文",
-    "oc": "奥克文",
-    "oj": "奥杰布瓦文",
     "om": "奥羅莫文",
     "or": "奥里雅文",
     "os": "奥塞梯文",
     "pa": "旁遮普文",
-    "pi": "巴利文",
     "pl": "波蘭文",
     "ps": "普什圖文",
     "pt": "葡萄牙文",
+    "pt_BR": "",
+    "pt_PT": "",
     "qu": "盖丘亞文",
     "rm": "羅曼什文",
     "rn": "基隆迪文",
     "ro": "羅馬尼亞文",
+    "ro_MD": "",
     "ru": "俄文",
     "rw": "盧旺達文",
     "sa": "梵文",
-    "sc": "撒丁文",
     "sd": "信德文",
     "se": "北薩米文",
     "sg": "桑戈文",
@@ -409,40 +442,33 @@
     "so": "索馬里文",
     "sq": "阿爾巴尼亞文",
     "sr": "塞爾維亞文",
-    "ss": "斯威士文",
     "st": "南索托文",
     "su": "巽他文",
     "sv": "瑞典文",
     "sw": "斯瓦希里文",
+    "sw_CD": "",
     "ta": "泰米爾文",
     "te": "泰盧固文",
     "tg": "塔吉克文",
     "th": "泰文",
     "ti": "提格里尼亞文",
     "tk": "土庫曼文",
-    "tl": "塔加拉族文",
-    "tn": "茨瓦納文",
     "to": "湯加文",
     "tr": "土耳其文",
-    "ts": "聰加文",
     "tt": "韃靼文",
-    "tw": "契維文",
-    "ty": "塔希提文",
     "ug": "維吾爾文",
     "uk": "烏克蘭文",
     "ur": "烏爾都文",
     "uz": "烏兹别克文",
-    "ve": "文達文",
     "vi": "越南文",
     "vo": "沃拉普克文",
-    "wa": "瓦隆文",
     "wo": "沃洛夫文",
     "xh": "科薩文",
     "yi": "意第绪文",
     "yo": "約鲁巴文",
-    "za": "壯文",
-    "zh-CN": "简体中文",
-    "zh" : "中文",
+    "zh": "中文",
+    "zh_Hans": "",
+    "zh_Hant": "",
     "zu": "祖鲁文"
   },
   "marketing": {
@@ -463,9 +489,11 @@
     "channels": "渠道",
     "collections": "商品列表",
     "countries": "國家",
+    "customer-groups": "",
     "customers": "客户",
     "facets": "特徵",
     "global-settings": "語言設定",
+    "job-queue": "",
     "marketing": "推銷",
     "orders": "訂單管理",
     "payment-methods": "付款方法",
@@ -475,12 +503,14 @@
     "sales": "銷售管理",
     "settings": "系统設定",
     "shipping-methods": "配送方式",
+    "system": "",
+    "system-status": "",
     "tax-categories": "税表分類",
-    "tax-rates": "税率管理"
+    "tax-rates": "税率管理",
+    "zones": ""
   },
   "order": {
     "add-note": "新增備注",
-    "add-note-success": "備注新增成功",
     "amount": "金額",
     "cancel": "取消",
     "cancel-order": "取消訂單",
@@ -493,7 +523,6 @@
     "create-fulfillment": "確認配貨",
     "create-fulfillment-success": "確認配貨成功",
     "customer": "客户",
-    "details": "詳情",
     "fulfill": "已配貨",
     "fulfill-order": "接受訂單",
     "fulfillment": "配貨記錄",
@@ -587,6 +616,7 @@
     "create-new-shipping-method": "新增配送方式",
     "create-new-tax-category": "建立税表分類",
     "create-new-tax-rate": "新增税率",
+    "create-new-zone": "",
     "create-zone": "建立銷售區域",
     "currency": "幣種",
     "customer": "客户管理",
@@ -596,6 +626,7 @@
     "delete": "移除",
     "eligible": "符合條件",
     "email-address": "電子郵件",
+    "filter-by-member-name": "",
     "first-name": "名",
     "last-name": "姓",
     "no-eligible-shipping-methods": "没有符合條件的配送方式",
@@ -607,13 +638,12 @@
     "promotion": "優惠券管理",
     "rate": "税率",
     "read": "只讀",
-    "remove-countries-from-zone": "移除國家...",
     "remove-countries-from-zone-success": "{ countryCount }個國際已從\"{ zoneName }\"中移除",
+    "remove-from-zone": "",
     "roles": "角色列表",
     "search-by-product-name-or-sku": "輸入要搜索的產品名稱或庫存編碼",
     "search-country-by-name": "輸入要搜索的國家名稱",
     "section": "操作項目",
-    "select-zone": "選擇銷售區域",
     "settings": "系统設定",
     "shipping-calculator": "配送費計算",
     "shipping-eligibility-checker": "使用此配送方式的合格條件",
@@ -627,9 +657,26 @@
     "test-shipping-methods": "模擬測試配送方式",
     "track-inventory-default": "默認跟踪庫存",
     "update": "修改",
+    "update-zone": "",
+    "view-zone-members": "",
     "zone": "銷售區域"
   },
   "system": {
-    "jobs-in-progress": "{ count }個任務正在運行"
+    "all-job-queues": "",
+    "health-all-systems-up": "",
+    "health-error": "",
+    "health-last-checked": "",
+    "health-message": "",
+    "health-refresh": "",
+    "health-status": "",
+    "health-status-down": "",
+    "health-status-up": "",
+    "hide-settled-jobs": "",
+    "job-data": "",
+    "job-duration": "",
+    "job-error": "",
+    "job-queue-name": "",
+    "job-result": "",
+    "job-state": ""
   }
-}
+}