From 41f7e385473892dda6e3b92a76faa69190ddaafb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=93=E3=81=B4=E3=81=AA=E3=81=9F=E3=81=BF=E3=81=BD?= Date: Wed, 17 May 2017 06:22:54 +0900 Subject: [PATCH] Update i18n.ts --- webpack/module/rules/i18n.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/webpack/module/rules/i18n.ts b/webpack/module/rules/i18n.ts index 0539e97db4..3023253cab 100644 --- a/webpack/module/rules/i18n.ts +++ b/webpack/module/rules/i18n.ts @@ -13,6 +13,8 @@ export default (lang, locale) => ({ { pattern: /%i18n:(.+?)%/g, replacement: (_, key) => { let text = locale; + + // Check the key existance const error = key.split('.').some(k => { if (text.hasOwnProperty(k)) { text = text[k]; @@ -21,9 +23,10 @@ export default (lang, locale) => ({ return true; } }); + if (error) { console.warn(`key '${key}' not found in '${lang}'`); - return key; + return key; // Fallback } else { return text.replace(/'/g, '\\\'').replace(/"/g, '\\"'); }