mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
Fixed translation services
This commit is contained in:
parent
a0ac51fe9c
commit
4b33ff877c
@ -63,6 +63,7 @@ export class AppComponent {
|
||||
|
||||
this.translate = translate;
|
||||
this.translate.translationInit();
|
||||
this.translate.addComponent('');
|
||||
}
|
||||
|
||||
isActive(instruction: any[]): boolean {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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[]) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user