diff --git a/projects/ngx-translate/src/lib/translate.service.ts b/projects/ngx-translate/src/lib/translate.service.ts index 8ecc0e3..53bc1c4 100644 --- a/projects/ngx-translate/src/lib/translate.service.ts +++ b/projects/ngx-translate/src/lib/translate.service.ts @@ -399,12 +399,12 @@ export class TranslateService { /** * Add available languages */ - public addLangs(langs: string[]): void { - langs.forEach((lang: string) => { - if (this.langs.indexOf(lang) === -1) { - this.langs.push(lang); - } - }); + public addLangs(langs: string[]): void + { + const newLangs = langs.filter(lang => !this.langs.includes(lang)); + if (newLangs.length > 0) { + this.langs = [...this.langs, ...newLangs]; + } } /**