Fixed translation services

This commit is contained in:
mauriziovitale84 2016-06-03 15:54:34 +01:00
parent a0ac51fe9c
commit 4b33ff877c
3 changed files with 9 additions and 5 deletions

View File

@ -63,6 +63,7 @@ export class AppComponent {
this.translate = translate;
this.translate.translationInit();
this.translate.addComponent('');
}
isActive(instruction: any[]): boolean {

View File

@ -29,19 +29,19 @@ export class AlfrescoTranslationService extends TranslateService {
super(http, currentLoader, missingTranslationHandler);
}
translationInit(name: string = ''): void {
translationInit(name?: string): void {
let userLang = navigator.language.split('-')[0]; // use navigator lang if available
userLang = /(fr|en)/gi.test(userLang) ? userLang : 'en';
this.userLang = userLang;
this.setDefaultLang(this.userLang);
this.addComponent(name);
this.use(this.userLang);
}
addComponent(name: string) {
if (!this.currentLoader.existComponent(name)) {
if (name && !this.currentLoader.existComponent(name)) {
this.currentLoader.addComponentList(name);
this.getTranslation(this.userLang);
}
this.use(this.userLang);
}
}

View File

@ -18,7 +18,7 @@
import { Component, ChangeDetectorRef, OnInit } from 'angular2/core';
import { FileModel } from '../models/file.model';
import { FileUploadingListComponent } from './file-uploading-list.component';
import { AlfrescoPipeTranslate } from 'ng2-alfresco-core/dist/ng2-alfresco-core';
import { AlfrescoTranslationService, AlfrescoPipeTranslate } from 'ng2-alfresco-core/dist/ng2-alfresco-core';
import { UploadService } from '../services/upload.service';
declare let __moduleName: string;
@ -54,7 +54,10 @@ export class FileUploadingDialogComponent implements OnInit{
private _isDialogMinimized: boolean = false;
constructor(private cd: ChangeDetectorRef,
private _uploaderService: UploadService) {}
translate: AlfrescoTranslationService,
private _uploaderService: UploadService) {
translate.addComponent('node_modules/ng2-alfresco-upload');
}
ngOnInit() {
this._uploaderService.filesUpload$.subscribe((fileList: FileModel[]) => {