Skip to content

Commit

Permalink
feat(service): allow empty default language string (#972)
Browse files Browse the repository at this point in the history
Fixes #971
  • Loading branch information
JuleSch committed Feb 5, 2020
1 parent 248e77d commit 94bdc0d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions projects/ngx-translate/core/src/lib/translate.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export class TranslateService {

if (typeof pending !== "undefined") {
// on init set the defaultLang immediately
if (!this.defaultLang) {
if (this.defaultLang == null) {
this.defaultLang = lang;
}

Expand Down Expand Up @@ -340,7 +340,7 @@ export class TranslateService {
res = this.parser.interpolate(this.parser.getValue(translations, key), interpolateParams);
}

if (typeof res === "undefined" && this.defaultLang && this.defaultLang !== this.currentLang && this.useDefaultLang) {
if (typeof res === "undefined" && this.defaultLang != null && this.defaultLang !== this.currentLang && this.useDefaultLang) {
res = this.parser.interpolate(this.parser.getValue(this.translations[this.defaultLang], key), interpolateParams);
}

Expand Down Expand Up @@ -438,7 +438,7 @@ export class TranslateService {
this.onLangChange.emit({lang: lang, translations: this.translations[lang]});

// if there is no default lang, use the one that we just set
if (!this.defaultLang) {
if (this.defaultLang == null) {
this.changeDefaultLang(lang);
}
}
Expand Down

0 comments on commit 94bdc0d

Please sign in to comment.