mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Fixed multiple add path of same single component
This commit is contained in:
@@ -34,11 +34,15 @@ export class AlfrescoTranslationLoader implements TranslateLoader {
|
||||
this._componentList.push(name);
|
||||
}
|
||||
|
||||
getTranslation(lang: string): Observable<any> {
|
||||
existComponent(name: string) {
|
||||
return this._componentList.indexOf(name) >= 0;
|
||||
}
|
||||
|
||||
getTranslation(lang: string): Observable<any> {
|
||||
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()));
|
||||
});
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user