From 512fd99a0d6751ffc3915de6a043d2e6fe01f1e4 Mon Sep 17 00:00:00 2001 From: Yusuke Yanaka Date: Fri, 7 Jan 2022 03:19:07 +0900 Subject: [PATCH] fix(@aws-amplify/core): use empty string as translation (#9403) * fix for using empty string as translation * Update I18n.ts strict inequality with undefined for the dictionary values Co-authored-by: Eddy Varela Co-authored-by: Nick Arocho <16296496+nickarocho@users.noreply.github.com> --- packages/core/src/I18n/I18n.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/I18n/I18n.ts b/packages/core/src/I18n/I18n.ts index 9a20007a02f..1baafbcc3bf 100644 --- a/packages/core/src/I18n/I18n.ts +++ b/packages/core/src/I18n/I18n.ts @@ -78,14 +78,14 @@ export class I18n { const lang = this._lang; let val = this.getByLanguage(key, lang); - if (val) { + if (val !== undefined) { return val; } if (lang.indexOf('-') > 0) { val = this.getByLanguage(key, lang.split('-')[0]); } - if (val) { + if (val !== undefined) { return val; } @@ -105,7 +105,7 @@ export class I18n { } const lang_dict = this._dict[language]; - if (!lang_dict) { + if (typeof lang_dict === 'undefined') { return defVal; }