mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
# Changed TranslationService
This commit is contained in:
@@ -61,7 +61,7 @@ export class AppComponent {
|
|||||||
alfrescoSettingsService.host = 'http://192.168.99.100:8080';
|
alfrescoSettingsService.host = 'http://192.168.99.100:8080';
|
||||||
|
|
||||||
this.translate = translate;
|
this.translate = translate;
|
||||||
this.translate.translationInit(' ');
|
this.translate.addTranslationFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
isActive(instruction: any[]): boolean {
|
isActive(instruction: any[]): boolean {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ng2-alfresco-core",
|
"name": "ng2-alfresco-core",
|
||||||
"description": "Alfresco Angular 2 Components core",
|
"description": "Alfresco Angular 2 Components core",
|
||||||
"version": "0.1.26",
|
"version": "0.1.27",
|
||||||
"author": "Alfresco Software, Ltd.",
|
"author": "Alfresco Software, Ltd.",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"typings": "typings install",
|
"typings": "typings install",
|
||||||
|
@@ -27,18 +27,13 @@ export class AlfrescoTranslationService extends TranslateService {
|
|||||||
|
|
||||||
constructor(http: Http, currentLoader: AlfrescoTranslationLoader, @Optional() missingTranslationHandler: MissingTranslationHandler) {
|
constructor(http: Http, currentLoader: AlfrescoTranslationLoader, @Optional() missingTranslationHandler: MissingTranslationHandler) {
|
||||||
super(http, currentLoader, missingTranslationHandler);
|
super(http, currentLoader, missingTranslationHandler);
|
||||||
}
|
this.userLang = navigator.language.split('-')[0]; // use navigator lang if available
|
||||||
|
this.userLang = /(fr|en)/gi.test(this.userLang) ? this.userLang : 'en';
|
||||||
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.setDefaultLang(this.userLang);
|
||||||
this.addComponent(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addComponent(name: string) {
|
addTranslationFolder(name: string = '') {
|
||||||
if (name && !this.currentLoader.existComponent(name)) {
|
if (!this.currentLoader.existComponent(name)) {
|
||||||
this.currentLoader.addComponentList(name);
|
this.currentLoader.addComponentList(name);
|
||||||
this.getTranslation(this.userLang);
|
this.getTranslation(this.userLang);
|
||||||
}
|
}
|
||||||
|
@@ -95,7 +95,7 @@ class DocumentListDemo implements OnInit {
|
|||||||
documentActions: DocumentActionsService) {
|
documentActions: DocumentActionsService) {
|
||||||
|
|
||||||
settings.host = 'http://192.168.99.100:8080';
|
settings.host = 'http://192.168.99.100:8080';
|
||||||
translation.translationInit();
|
translation.addTranslationFolder();
|
||||||
documentActions.setHandler('my-handler', this.myDocumentActionHandler.bind(this));
|
documentActions.setHandler('my-handler', this.myDocumentActionHandler.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -160,7 +160,7 @@ class DocumentListDemo implements OnInit {
|
|||||||
this.token = localStorage.getItem('token');
|
this.token = localStorage.getItem('token');
|
||||||
}
|
}
|
||||||
|
|
||||||
translation.translationInit(' ');
|
translation.addTranslationFolder();
|
||||||
documentActions.setHandler('my-handler', this.myDocumentActionHandler.bind(this));
|
documentActions.setHandler('my-handler', this.myDocumentActionHandler.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ng2-alfresco-documentlist",
|
"name": "ng2-alfresco-documentlist",
|
||||||
"description": "Alfresco Angular2 Document List Component",
|
"description": "Alfresco Angular2 Document List Component",
|
||||||
"version": "0.1.20",
|
"version": "0.1.21",
|
||||||
"author": "Alfresco Software, Ltd.",
|
"author": "Alfresco Software, Ltd.",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"typings": "typings install",
|
"typings": "typings install",
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ng2-alfresco-login",
|
"name": "ng2-alfresco-login",
|
||||||
"description": "Alfresco Angular2 Login Component",
|
"description": "Alfresco Angular2 Login Component",
|
||||||
"version": "0.1.14",
|
"version": "0.1.15",
|
||||||
"author": "Alfresco Software, Ltd.",
|
"author": "Alfresco Software, Ltd.",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"typings": "typings install",
|
"typings": "typings install",
|
||||||
|
@@ -88,7 +88,7 @@ export class AlfrescoLoginComponent {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
translate.addComponent('node_modules/ng2-alfresco-login');
|
translate.addTranslationFolder('node_modules/ng2-alfresco-login');
|
||||||
|
|
||||||
this.form.valueChanges.subscribe(data => this.onValueChanged(data));
|
this.form.valueChanges.subscribe(data => this.onValueChanged(data));
|
||||||
|
|
||||||
|
@@ -132,7 +132,7 @@ class SearchDemo implements OnInit {
|
|||||||
translation: AlfrescoTranslationService) {
|
translation: AlfrescoTranslationService) {
|
||||||
|
|
||||||
settings.host = this.host;
|
settings.host = this.host;
|
||||||
translation.translationInit();
|
translation.addTranslationFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
searchTermChange(event) {
|
searchTermChange(event) {
|
||||||
@@ -281,7 +281,7 @@ class SearchDemo implements OnInit {
|
|||||||
translation: AlfrescoTranslationService) {
|
translation: AlfrescoTranslationService) {
|
||||||
|
|
||||||
settings.host = this.host;
|
settings.host = this.host;
|
||||||
translation.translationInit();
|
translation.addTranslationFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
searchTermChange(event) {
|
searchTermChange(event) {
|
||||||
|
@@ -76,7 +76,7 @@ class SearchDemo implements OnInit {
|
|||||||
this.token = localStorage.getItem('token');
|
this.token = localStorage.getItem('token');
|
||||||
}
|
}
|
||||||
|
|
||||||
translation.translationInit();
|
translation.addTranslationFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateToken(): void {
|
public updateToken(): void {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ng2-alfresco-search",
|
"name": "ng2-alfresco-search",
|
||||||
"description": "Alfresco Angular2 Search Component",
|
"description": "Alfresco Angular2 Search Component",
|
||||||
"version": "0.1.14",
|
"version": "0.1.15",
|
||||||
"author": "Alfresco Software, Ltd.",
|
"author": "Alfresco Software, Ltd.",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"typings": "typings install",
|
"typings": "typings install",
|
||||||
|
@@ -48,7 +48,7 @@ export class AlfrescoSearchComponent implements OnChanges, OnInit {
|
|||||||
private translate: AlfrescoTranslationService,
|
private translate: AlfrescoTranslationService,
|
||||||
@Optional() params: RouteParams)
|
@Optional() params: RouteParams)
|
||||||
{
|
{
|
||||||
translate.addComponent('node_modules/ng2-alfresco-search');
|
translate.addTranslationFolder('node_modules/ng2-alfresco-search');
|
||||||
|
|
||||||
this.results = null;
|
this.results = null;
|
||||||
if (params) {
|
if (params) {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ng2-alfresco-upload",
|
"name": "ng2-alfresco-upload",
|
||||||
"description": "Alfresco Angular2 Upload Component",
|
"description": "Alfresco Angular2 Upload Component",
|
||||||
"version": "0.1.32",
|
"version": "0.1.33",
|
||||||
"author": "Alfresco Software, Ltd.",
|
"author": "Alfresco Software, Ltd.",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"typings": "typings install",
|
"typings": "typings install",
|
||||||
|
@@ -35,7 +35,7 @@ export class TranslationMock {
|
|||||||
console.log('mock');
|
console.log('mock');
|
||||||
}
|
}
|
||||||
|
|
||||||
addComponent() {
|
addTranslationFolder() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -56,7 +56,7 @@ export class FileUploadingDialogComponent implements OnInit{
|
|||||||
constructor(private cd: ChangeDetectorRef,
|
constructor(private cd: ChangeDetectorRef,
|
||||||
translate: AlfrescoTranslationService,
|
translate: AlfrescoTranslationService,
|
||||||
private _uploaderService: UploadService) {
|
private _uploaderService: UploadService) {
|
||||||
translate.addComponent('node_modules/ng2-alfresco-upload');
|
translate.addTranslationFolder('node_modules/ng2-alfresco-upload');
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@@ -95,7 +95,7 @@ export class UploadButtonComponent {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.translate = translate;
|
this.translate = translate;
|
||||||
this.translate.addComponent('node_modules/ng2-alfresco-upload');
|
this.translate.addTranslationFolder('node_modules/ng2-alfresco-upload');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -104,7 +104,7 @@ export class UploadButtonComponent {
|
|||||||
* @param {File[]} files - files dropped in the drag area.
|
* @param {File[]} files - files dropped in the drag area.
|
||||||
*/
|
*/
|
||||||
onFilesAdded($event: any): void {
|
onFilesAdded($event: any): void {
|
||||||
let files = $event.currentTarget.files;
|
let files = $event.currentTarget.files;alfres
|
||||||
this.printFileInfo(files);
|
this.printFileInfo(files);
|
||||||
this.uploadFiles(this.uploaddirectory, files);
|
this.uploadFiles(this.uploaddirectory, files);
|
||||||
// reset the value of the input file
|
// reset the value of the input file
|
||||||
|
Reference in New Issue
Block a user