From 21c6073309998f15a504198c135bfc420264d9a7 Mon Sep 17 00:00:00 2001 From: Xc Date: Mon, 30 Oct 2023 13:34:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86locale=E7=9A=84?= =?UTF-8?q?=E5=87=BA=E9=94=99=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- es/features/locales.js | 7 +++++-- lib/features/locales.js | 7 +++++-- src/features/locales.ts | 8 ++++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/es/features/locales.js b/es/features/locales.js index baab3aa5..d25deed8 100644 --- a/es/features/locales.js +++ b/es/features/locales.js @@ -112,8 +112,11 @@ export class Locales extends Feature { this.i18n.store(dataset); this.publish(); } - else { - // console.warn(`命名空间${ns}中的${key}缺失且可能请求不到更新的数据,请检查`); + if (!this.hasKey(key)) { + console.warn(`命名空间${ns}中的${key}缺失且可能请求不到更新的数据`); + if (process.env.NODE_ENV === 'development') { + console.warn('请增加好相应的键值后执行make:locale'); + } } } /** diff --git a/lib/features/locales.js b/lib/features/locales.js index 75431cc0..3309f5ac 100644 --- a/lib/features/locales.js +++ b/lib/features/locales.js @@ -115,8 +115,11 @@ class Locales extends Feature_1.Feature { this.i18n.store(dataset); this.publish(); } - else { - // console.warn(`命名空间${ns}中的${key}缺失且可能请求不到更新的数据,请检查`); + if (!this.hasKey(key)) { + console.warn(`命名空间${ns}中的${key}缺失且可能请求不到更新的数据`); + if (process.env.NODE_ENV === 'development') { + console.warn('请增加好相应的键值后执行make:locale'); + } } } /** diff --git a/src/features/locales.ts b/src/features/locales.ts index d98420ec..46a74632 100644 --- a/src/features/locales.ts +++ b/src/features/locales.ts @@ -140,8 +140,12 @@ export class Locales