Skip to content

Commit 94bdc0d

Browse files
authored
feat(service): allow empty default language string (#972)
Fixes #971
1 parent 248e77d commit 94bdc0d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

projects/ngx-translate/core/src/lib/translate.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export class TranslateService {
169169

170170
if (typeof pending !== "undefined") {
171171
// on init set the defaultLang immediately
172-
if (!this.defaultLang) {
172+
if (this.defaultLang == null) {
173173
this.defaultLang = lang;
174174
}
175175

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

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

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

440440
// if there is no default lang, use the one that we just set
441-
if (!this.defaultLang) {
441+
if (this.defaultLang == null) {
442442
this.changeDefaultLang(lang);
443443
}
444444
}

0 commit comments

Comments
 (0)