Skip to content

Commit

Permalink
fix(@aws-amplify/core): use empty string as translation (#9403)
Browse files Browse the repository at this point in the history
* fix for using empty string as translation

* Update I18n.ts

strict inequality with undefined for the dictionary values

Co-authored-by: Eddy Varela <eddvar@amazon.com>
Co-authored-by: Nick Arocho <16296496+nickarocho@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 6, 2022
1 parent 0b1c9b7 commit 512fd99
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/I18n/I18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -105,7 +105,7 @@ export class I18n {
}

const lang_dict = this._dict[language];
if (!lang_dict) {
if (typeof lang_dict === 'undefined') {
return defVal;
}

Expand Down

0 comments on commit 512fd99

Please sign in to comment.