diff --git a/ng2-components/ng2-alfresco-core/src/services/AlfrescoTranslationLoader.service.ts b/ng2-components/ng2-alfresco-core/src/services/AlfrescoTranslationLoader.service.ts index 9cc83c32ea..244ed767c6 100644 --- a/ng2-components/ng2-alfresco-core/src/services/AlfrescoTranslationLoader.service.ts +++ b/ng2-components/ng2-alfresco-core/src/services/AlfrescoTranslationLoader.service.ts @@ -34,11 +34,15 @@ export class AlfrescoTranslationLoader implements TranslateLoader { this._componentList.push(name); } - getTranslation(lang: string): Observable { + existComponent(name: string) { + return this._componentList.indexOf(name) >= 0; + } + getTranslation(lang: string): Observable { + let self = this; let observableBatch = []; this._componentList.forEach((component) => { - observableBatch.push(this.http.get(`${component}/${this.prefix}/${lang}${this.suffix}`) + observableBatch.push(this.http.get(`${component}/${self.prefix}/${lang}${self.suffix}`) .map((res: Response) => res.json())); }); diff --git a/ng2-components/ng2-alfresco-core/src/services/AlfrescoTranslationService.service.ts b/ng2-components/ng2-alfresco-core/src/services/AlfrescoTranslationService.service.ts index a9f9cba646..b3feda3a58 100644 --- a/ng2-components/ng2-alfresco-core/src/services/AlfrescoTranslationService.service.ts +++ b/ng2-components/ng2-alfresco-core/src/services/AlfrescoTranslationService.service.ts @@ -108,8 +108,10 @@ export class AlfrescoTranslationService { } addComponent(name: string) { - this.currentLoader.addComponentList(name); - this.getTranslation(this.userLang); + if (!this.currentLoader.existComponent(name)) { + this.currentLoader.addComponentList(name); + this.getTranslation(this.userLang); + } } /**