You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The string of my default language, is an empty string.
If I use a language that contains a missing translation, the default language is normally used.
But if the default language consists an empty string (in my case), it will be overwritten with the used language.
Expected behavior
The default language should not be overwritten.
How do you think that we should fix this?
In the file ngx-translate/core/src/lib/translate.service.ts there are three queries for existing default language.
Lines 170 and 460 contain if (!this.defaultLang)
and in line 343 if (typeof res === "undefined" && this.defaultLang ...
These queries should be changed to: if (this.defaultLang == null)
and to if (typeof res === "undefined" && this.defaultLang != null...
Minimal reproduction of the problem with instructions
If the method changeLang() is called with the language 'de' and the translation key in 'de' does not exist, the system does not switch to the default language, but simply displays the key string.
An empty string is now also allowed as default language.
It checks if the default language is null.
The check for 'undefined' is implied because of the use of == instead of ===.
Current behavior
The string of my default language, is an empty string.
If I use a language that contains a missing translation, the default language is normally used.
But if the default language consists an empty string (in my case), it will be overwritten with the used language.
Expected behavior
The default language should not be overwritten.
How do you think that we should fix this?
In the file ngx-translate/core/src/lib/translate.service.ts there are three queries for existing default language.
Lines 170 and 460 contain
if (!this.defaultLang)
and in line 343
if (typeof res === "undefined" && this.defaultLang ...
These queries should be changed to:
if (
this.defaultLang == null
)
and to
if (typeof res === "undefined" &&
this.defaultLang != null
...
Minimal reproduction of the problem with instructions
app.component.ts
If the method changeLang() is called with the language 'de' and the translation key in 'de' does not exist, the system does not switch to the default language, but simply displays the key string.
Environment
The text was updated successfully, but these errors were encountered: