From 1ec2bb48af06f904356b47e12ce6dba04e95b332 Mon Sep 17 00:00:00 2001 From: eeeeelle <73626725+eeeeelle@users.noreply.github.com> Date: Fri, 16 Jul 2021 13:24:11 +0800 Subject: [PATCH 1/2] Feat more locale (#751) refactor: support more language --- components/_locale/index.js | 2 +- components/_locale/lang/en-US.js | 62 +++++++++++++++++++ components/_locale/lang/es-MX.js | 62 +++++++++++++++++++ .../_locale/lang/{zh-cn.js => zh-CN.js} | 26 ++++---- components/action-sheet/action-sheet.vue | 2 +- components/date-picker/index.vue | 10 +-- components/number-keyboard/board.vue | 2 +- components/result-page/index.vue | 6 +- components/scroll-view/more.vue | 4 +- components/scroll-view/refresh.vue | 6 +- components/tab-picker/index.vue | 2 +- 11 files changed, 153 insertions(+), 31 deletions(-) create mode 100644 components/_locale/lang/en-US.js create mode 100644 components/_locale/lang/es-MX.js rename components/_locale/lang/{zh-cn.js => zh-CN.js} (83%) diff --git a/components/_locale/index.js b/components/_locale/index.js index 75e52c21..bb41a1a5 100644 --- a/components/_locale/index.js +++ b/components/_locale/index.js @@ -1,4 +1,4 @@ -import defaultLang from './lang/zh-cn' +import defaultLang from './lang/zh-CN' let lang = defaultLang diff --git a/components/_locale/lang/en-US.js b/components/_locale/lang/en-US.js new file mode 100644 index 00000000..5cc340bd --- /dev/null +++ b/components/_locale/lang/en-US.js @@ -0,0 +1,62 @@ +export default { + md: { + result_page: { + networkError: 'Network error', + noInformation: 'No data available', + lostWay: 'Page not found', + }, + date_picker: { + month: 'Month', + minute: 'Minute', + hour: 'Hour', + day: 'Day', + second: 'Second', + year: 'Year', + }, + cashier: { + payCash: 'Amount', + payFail: 'Error. Try again later', + payResultSearch: 'Processing...', + morePayWays: 'Other payment method', + confirm: 'OK', + confirmPay: 'Confirm and Pay', + pay: 'Pay', + paySuccess: 'Payment successful', + }, + scroll_view: { + refresh: { + freedRefresh: 'Release', + pullDownRefresh: 'Pull down', + refreshing: 'Refreshing...', + }, + more: { + loading: 'Loading more...', + allLoaded: 'All loaded', + }, + }, + captcha: { + sendCaptcha: 'Send Code', + countdown: 'Resend in {$1}s', + }, + tab_picker: { + choose: 'Select', + }, + dialog: { + confirm: 'OK', + cancel: 'Cancel', + }, + action_sheet: { + cancel: 'Cancel', + }, + selector: { + cancel: 'Cancel', + }, + number_keyboard: { + confirm: 'OK', + }, + picker: { + cancel: 'Cancel', + confirm: 'Confirm', + }, + }, +} diff --git a/components/_locale/lang/es-MX.js b/components/_locale/lang/es-MX.js new file mode 100644 index 00000000..bb2e7f77 --- /dev/null +++ b/components/_locale/lang/es-MX.js @@ -0,0 +1,62 @@ +export default { + md: { + result_page: { + networkError: 'Error de red', + noInformation: 'No hay datos disponibles', + lostWay: 'No se encontró la página', + }, + date_picker: { + month: 'Mes', + minute: 'Minutos', + hour: 'Horas', + day: 'Día', + second: 'Segundo', + year: 'Año', + }, + cashier: { + payCash: 'Monto', + payFail: 'Error. Intenta de nuevo.', + payResultSearch: 'Procesando...', + morePayWays: 'Otro método de pago', + confirm: 'Aceptar', + confirmPay: 'Confirmar y pagar', + pay: 'Pago', + paySuccess: 'Pago realizado', + }, + scroll_view: { + refresh: { + freedRefresh: 'Suelta', + pullDownRefresh: 'Arrastra hacia abajo', + refreshing: 'Actualizando...', + }, + more: { + loading: 'Cargando más...', + allLoaded: 'Carga completa', + }, + }, + captcha: { + sendCaptcha: 'Enviar código', + countdown: 'Reenviar en {$1}s', + }, + tab_picker: { + choose: 'Elige una opción', + }, + dialog: { + confirm: 'Aceptar', + cancel: 'Cancelar', + }, + action_sheet: { + cancel: 'Cancelar', + }, + selector: { + cancel: 'Cancelar', + }, + number_keyboard: { + confirm: 'Aceptar', + }, + picker: { + cancel: 'Cancelar', + confirm: 'Confirmar', + }, + }, +} diff --git a/components/_locale/lang/zh-cn.js b/components/_locale/lang/zh-CN.js similarity index 83% rename from components/_locale/lang/zh-cn.js rename to components/_locale/lang/zh-CN.js index af8552d0..5a4812d5 100644 --- a/components/_locale/lang/zh-cn.js +++ b/components/_locale/lang/zh-CN.js @@ -1,13 +1,11 @@ export default { - // [\u4e00-\u9fa5] - name: 'zh-cn', md: { - 'action-sheet': { + action_sheet: { cancel: '取消', }, captcha: { sendCaptcha: '发送验证码', - countdown: '{$1}秒后重发' + countdown: '{$1}秒后重发', }, cashier: { payCash: '\u652f\u4ed8\u91d1\u989d\u0028\u5143\u0029', @@ -19,30 +17,30 @@ export default { payFail: '\u652f\u4ed8\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5', confirm: '\u6211\u77e5\u9053\u4e86', }, - 'date-picker': { + date_picker: { year: '年', month: '月', day: '日', hour: '时', minute: '分', }, - 'dialog': { + dialog: { confirm: '确定', cancel: '取消', }, - 'number-keyboard': { + number_keyboard: { confirm: '确定', }, - 'picker': { + picker: { confirm: '确认', cancel: '取消', }, - 'result-page': { + result_page: { networkError: '\u7f51\u7edc\u8fde\u63a5\u5f02\u5e38', noInformation: '\u6682\u65e0\u4fe1\u606f', lostWay: '\u60a8\u8981\u8bbf\u95ee\u7684\u9875\u9762\u5df2\u4e22\u5931', }, - 'scroll-view': { + scroll_view: { more: { loading: '更多加载中...', allLoaded: '全部已加载', @@ -53,11 +51,11 @@ export default { refreshing: '刷新中...', }, }, - 'selector': { + selector: { cancel: '取消', }, - 'tab-picker': { + tab_picker: { choose: '请选择', - } - } + }, + }, } diff --git a/components/action-sheet/action-sheet.vue b/components/action-sheet/action-sheet.vue index 42438272..9d36c2f4 100644 --- a/components/action-sheet/action-sheet.vue +++ b/components/action-sheet/action-sheet.vue @@ -69,7 +69,7 @@ export default { }, cancelText: { type: String, - default: t('md.action-sheet.cancel'), + default: t('md.action_sheet.cancel'), }, }, diff --git a/components/date-picker/index.vue b/components/date-picker/index.vue index c7e94eb4..503229e1 100644 --- a/components/date-picker/index.vue +++ b/components/date-picker/index.vue @@ -109,11 +109,11 @@ export default { type: Array, default () { return [ - t('md.date-picker.year'), - t('md.date-picker.month'), - t('md.date-picker.day'), - t('md.date-picker.hour'), - t('md.date-picker.minute'), + t('md.date_picker.year'), + t('md.date_picker.month'), + t('md.date_picker.day'), + t('md.date_picker.hour'), + t('md.date_picker.minute'), ] } }, diff --git a/components/number-keyboard/board.vue b/components/number-keyboard/board.vue index 7aa9c51f..52df67fd 100644 --- a/components/number-keyboard/board.vue +++ b/components/number-keyboard/board.vue @@ -90,7 +90,7 @@ export default { }, okText: { type: String, - default: t('md.number-keyboard.confirm'), + default: t('md.number_keyboard.confirm'), }, isView: { type: Boolean, diff --git a/components/result-page/index.vue b/components/result-page/index.vue index 2ac33a0a..15214ed6 100644 --- a/components/result-page/index.vue +++ b/components/result-page/index.vue @@ -70,9 +70,9 @@ export default { this.text || { // 网络连接异常 - network: t('md.result-page.networkError'), + network: t('md.result_page.networkError'), // 暂无信息 - empty: t('md.result-page.noInformation'), + empty: t('md.result_page.noInformation'), }[this.type] || '' ) @@ -82,7 +82,7 @@ export default { this.subtext || { // 您要访问的页面已丢失 - lost: t('md.result-page.lostWay'), + lost: t('md.result_page.lostWay'), }[this.type] || '' ) diff --git a/components/scroll-view/more.vue b/components/scroll-view/more.vue index 28719a93..f7b42aad 100644 --- a/components/scroll-view/more.vue +++ b/components/scroll-view/more.vue @@ -16,11 +16,11 @@ export default { props: { loadingText: { type: String, - default: t('md.scroll-view.more.loading'), + default: t('md.scroll_view.more.loading'), }, finishedText: { type: String, - default: t('md.scroll-view.more.allLoaded'), + default: t('md.scroll_view.more.allLoaded'), }, isFinished: { type: Boolean, diff --git a/components/scroll-view/refresh.vue b/components/scroll-view/refresh.vue index 4acebd33..4f465f13 100644 --- a/components/scroll-view/refresh.vue +++ b/components/scroll-view/refresh.vue @@ -34,15 +34,15 @@ export default { }, refreshText: { type: String, - default: t('md.scroll-view.refresh.pullDownRefresh'), + default: t('md.scroll_view.refresh.pullDownRefresh'), }, refreshActiveText: { type: String, - default: t('md.scroll-view.refresh.freedRefresh'), + default: t('md.scroll_view.refresh.freedRefresh'), }, refreshingText: { type: String, - default: t('md.scroll-view.refresh.refreshing'), + default: t('md.scroll_view.refresh.refreshing'), }, rollerColor: { type: String, diff --git a/components/tab-picker/index.vue b/components/tab-picker/index.vue index 731a652b..9d74e6dc 100644 --- a/components/tab-picker/index.vue +++ b/components/tab-picker/index.vue @@ -95,7 +95,7 @@ export default { }, placeholder: { type: String, - default: t('md.tab-picker.choose'), + default: t('md.tab_picker.choose'), }, // Mixin Props From 6eabfd87b304f93d9a4e214054705793c52817d3 Mon Sep 17 00:00:00 2001 From: zouhang Date: Thu, 22 Jul 2021 11:43:25 +0800 Subject: [PATCH 2/2] Bump up version to 2.5.20 --- CHANGELOG.en-US.md | 7 +++++++ CHANGELOG.md | 7 +++++++ package.json | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index b6397ba3..feecab66 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -3,6 +3,13 @@ title: Change Log toc: hidden --- +### 2.5.20 + +`2021-07-22` + +- Feat + - Add more i18n support in the project + ### 2.5.19 `2021-05-14` diff --git a/CHANGELOG.md b/CHANGELOG.md index 714e5040..4edf0a84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ title: 更新日志 toc: hidden --- +### 2.5.20 + +`2021-07-22` + +- Feat + - 添加更多的国际化支持 + ### 2.5.19 `2021-05-14` diff --git a/package.json b/package.json index e5d289bd..c4810e36 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mand-mobile", - "version": "2.5.19", + "version": "2.5.20", "description": "A Vue.js 2.0 Mobile UI Toolkit", "homepage": "https://didi.github.io/mand-mobile", "main": "lib/mand-mobile.umd.js",