From 67d26ff7902c272e8113c9b650382a1dcb0cdde0 Mon Sep 17 00:00:00 2001 From: r-q Date: Thu, 21 Jul 2022 23:06:17 +0800 Subject: [PATCH] minor: optimize i18n Optimized several translations. This commit itself is only a patch, but as a pull request must have at least one commit with a change-type. Change-Type: minor --- .../app/components/flash-results/flash-results.tsx | 7 ++++--- lib/gui/app/i18n/en.ts | 9 +++++++-- lib/gui/app/i18n/zh-CN.ts | 9 +++++++-- lib/gui/app/i18n/zh-TW.ts | 9 +++++++-- lib/shared/messages.ts | 11 +++++------ 5 files changed, 30 insertions(+), 15 deletions(-) diff --git a/lib/gui/app/components/flash-results/flash-results.tsx b/lib/gui/app/components/flash-results/flash-results.tsx index 51c8a032..766df43c 100644 --- a/lib/gui/app/components/flash-results/flash-results.tsx +++ b/lib/gui/app/components/flash-results/flash-results.tsx @@ -163,8 +163,9 @@ export function FlashResults({ {middleEllipsis(image, 24)} - {i18next.t('flash.flash')}{' '} - {allFailed ? i18next.t('failed') : i18next.t('completed')}! + {allFailed + ? i18next.t('flash.flashFailed') + : i18next.t('flash.flashCompleted')} {skip ? {i18next.t('flash.skip')} : null} @@ -203,7 +204,7 @@ export function FlashResults({ }} tooltip={i18next.t('flash.speedTip')} > - {i18next.t('flash.speed')} {effectiveSpeed} MB/s + {i18next.t('flash.speed', { speed: effectiveSpeed })} )} diff --git a/lib/gui/app/i18n/en.ts b/lib/gui/app/i18n/en.ts index a608745c..a201d4ef 100644 --- a/lib/gui/app/i18n/en.ts +++ b/lib/gui/app/i18n/en.ts @@ -33,7 +33,10 @@ const translation = { flashFail_one: 'Failed target', flashFail_other: 'Failed targets', to: 'to ', - andFail: 'and failed to be flashed to ', + succeedTarget_one: 'to {{num}} target', + succeedTarget_other: 'to {{num}} targets', + andFailTarget_one: 'and failed to be flashed to {{num}} target', + andFailTarget_other: 'and failed to be flashed to {{num}} targets', target_one: ' target', target_other: ' targets', succeedTo: 'was successfully flashed', @@ -123,9 +126,11 @@ const translation = { moreInfo: 'more info', speedTip: 'The speed is calculated by dividing the image size by the flashing time.\nDisk images with ext partitions flash faster as we are able to skip unused parts.', - speed: 'Effective speed: ', + speed: 'Effective speed: {{speed}} MB/s', failedTarget: 'Failed targets', failedRetry: 'Retry failed targets', + flashFailed: 'Flash Failed.', + flashCompleted: 'Flash Completed!', }, settings: { errorReporting: diff --git a/lib/gui/app/i18n/zh-CN.ts b/lib/gui/app/i18n/zh-CN.ts index 5c83b33a..2df35d8b 100644 --- a/lib/gui/app/i18n/zh-CN.ts +++ b/lib/gui/app/i18n/zh-CN.ts @@ -33,7 +33,10 @@ const translation = { flashFail_one: '烧录失败', flashFail_other: '烧录失败', to: '到 ', - andFail: '并烧录失败了 ', + succeedTarget_one: '到 {{num}} 个目标', + succeedTarget_other: '到 {{num}} 个目标', + andFailTarget_one: '并烧录失败了 {{num}} 个目标', + andFailTarget_other: '并烧录失败了 {{num}} 个目标', target_one: ' 个目标', target_other: ' 个目标', succeedTo: '被成功烧录', @@ -131,9 +134,11 @@ const translation = { moreInfo: '更多信息', speedTip: '通过将图像大小除以烧录时间来计算速度。\n由于我们能够跳过未使用的部分,因此具有EXT分区的磁盘镜像烧录速度更快。', - speed: '速度:', + speed: '速度:{{speed}} MB/秒', failedTarget: '失败的烧录目标', failedRetry: '重试烧录失败目标', + flashFailed: '烧录失败。', + flashCompleted: '烧录成功!', }, settings: { errorReporting: '匿名地向 balena.io 报告运行错误和使用统计', diff --git a/lib/gui/app/i18n/zh-TW.ts b/lib/gui/app/i18n/zh-TW.ts index 21ebf63e..87592aca 100644 --- a/lib/gui/app/i18n/zh-TW.ts +++ b/lib/gui/app/i18n/zh-TW.ts @@ -33,7 +33,10 @@ const translation = { flashFail_one: '燒錄失敗', flashFail_other: '燒錄失敗', to: '到 ', - andFail: '並燒錄失敗了 ', + succeedTarget_one: '到 {{num}} 個目標', + succeedTarget_other: '到 {{num}} 個目標', + andFailTarget_one: '並燒錄失敗了 {{num}} 個目標', + andFailTarget_other: '並燒錄失敗了 {{num}} 個目標', target_one: ' 個目標', target_other: ' 個目標', succeedTo: '被成功燒錄', @@ -131,9 +134,11 @@ const translation = { moreInfo: '更多信息', speedTip: '通過將圖像大小除以燒錄時間來計算速度。\n由於我們能夠跳過未使用的部分,因此具有EXT分區的磁盤鏡像燒錄速度更快。', - speed: '速度:', + speed: '速度:{{speed}} MB/秒', failedTarget: '失敗的燒錄目標', failedRetry: '重試燒錄失敗目標', + flashFailed: '燒錄失敗。', + flashCompleted: '燒錄成功!', }, settings: { errorReporting: '匿名地向 balena.io 報告運行錯誤和使用統計', diff --git a/lib/shared/messages.ts b/lib/shared/messages.ts index a0c66727..cf60aac7 100644 --- a/lib/shared/messages.ts +++ b/lib/shared/messages.ts @@ -44,16 +44,15 @@ export const info = { } else { if (successful) { targets.push( - i18next.t('message.to') + - successful + - i18next.t('message.target', { count: successful }), + i18next.t('message.succeedTarget', { + count: successful, + num: successful, + }), ); } if (failed) { targets.push( - i18next.t('message.andFail') + - failed + - i18next.t('message.target', { count: failed }), + i18next.t('message.andFailTarget', { count: failed, num: failed }), ); } }