From 79c12f31e48b977129b1606cc01dce24636d881a Mon Sep 17 00:00:00 2001 From: mauriziovitale84 Date: Wed, 11 May 2016 14:02:11 +0100 Subject: [PATCH] #46 ie18n --- .../ng2-alfresco-upload/i18n/en.json | 15 +++++++++- .../ng2-alfresco-upload/i18n/it.json | 13 ++++++++ .../file-uploading-dialog.component.html | 2 +- .../file-uploading-dialog.component.js | 10 +++++-- .../file-uploading-dialog.component.js.map | 2 +- .../file-uploading-dialog.component.ts | 4 ++- .../components/upload-button.component.html | 4 +-- .../src/components/upload-button.component.js | 30 ++++++++++++++----- .../components/upload-button.component.js.map | 2 +- .../src/components/upload-button.component.ts | 29 +++++++++++++++--- 10 files changed, 90 insertions(+), 21 deletions(-) diff --git a/ng2-components/ng2-alfresco-upload/i18n/en.json b/ng2-components/ng2-alfresco-upload/i18n/en.json index 7a73a41bfd..34fc7ee2a4 100644 --- a/ng2-components/ng2-alfresco-upload/i18n/en.json +++ b/ng2-components/ng2-alfresco-upload/i18n/en.json @@ -1,2 +1,15 @@ { -} \ No newline at end of file + "FILE_UPLOAD": { + "BUTTON": { + "UPLOAD_FILE": "Upload file", + "UPLOAD_FOLDER": "Upload folder" + }, + "MESSAGES": { + "COMPLETED": "uploads complete", + "PROGRESS": "Upload in progress..." + }, + "ACTION": { + "UNDO": "Undo" + } + } +} diff --git a/ng2-components/ng2-alfresco-upload/i18n/it.json b/ng2-components/ng2-alfresco-upload/i18n/it.json index 7a73a41bfd..6f15cd3935 100644 --- a/ng2-components/ng2-alfresco-upload/i18n/it.json +++ b/ng2-components/ng2-alfresco-upload/i18n/it.json @@ -1,2 +1,15 @@ { + "FILE_UPLOAD": { + "BUTTON": { + "UPLOAD_FILE": "Carica un file", + "UPLOAD_FOLDER": "Carica una cartella" + }, + "MESSAGES": { + "COMPLETED": "caricamento completato", + "PROGRESS": "caricamento in corso..." + }, + "ACTION": { + "UNDO": "Annulla" + } + } } \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.html b/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.html index eb6924c439..d010a449c1 100644 --- a/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.html +++ b/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.html @@ -1,7 +1,7 @@
- {{filesUploadingList.length}} uploads complete + {{filesUploadingList.length}} {{'FILE_UPLOAD.MESSAGES.COMPLETED' | translate}}
diff --git a/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.js b/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.js index 011c922e11..388d020ac1 100644 --- a/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.js +++ b/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.js @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -System.register(['angular2/core', './file-uploading-list.component'], function(exports_1, context_1) { +System.register(['angular2/core', './file-uploading-list.component', 'ng2-translate/ng2-translate'], function(exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { @@ -26,7 +26,7 @@ System.register(['angular2/core', './file-uploading-list.component'], function(e var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; - var core_1, file_uploading_list_component_1; + var core_1, file_uploading_list_component_1, ng2_translate_1; var FileUploadingDialogComponent; return { setters:[ @@ -35,6 +35,9 @@ System.register(['angular2/core', './file-uploading-list.component'], function(e }, function (file_uploading_list_component_1_1) { file_uploading_list_component_1 = file_uploading_list_component_1_1; + }, + function (ng2_translate_1_1) { + ng2_translate_1 = ng2_translate_1_1; }], execute: function() { /** @@ -84,7 +87,8 @@ System.register(['angular2/core', './file-uploading-list.component'], function(e directives: [file_uploading_list_component_1.FileUploadingListComponent], templateUrl: './file-uploading-dialog.component.html', styleUrls: ['./file-uploading-dialog.component.css'], - host: { '[class.dialog-show]': 'toggleShowDialog' } + host: { '[class.dialog-show]': 'toggleShowDialog' }, + pipes: [ng2_translate_1.TranslatePipe] }), __metadata('design:paramtypes', [core_1.ElementRef]) ], FileUploadingDialogComponent); diff --git a/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.js.map b/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.js.map index a10e758786..5a29b87c41 100644 --- a/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.js.map +++ b/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.js.map @@ -1 +1 @@ -{"version":3,"file":"file-uploading-dialog.component.js","sourceRoot":"","sources":["file-uploading-dialog.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;YASH;;;;;;;;;;eAUG;YASH;gBASI,sCAAmB,EAAc;oBAAd,OAAE,GAAF,EAAE,CAAY;oBAJzB,oBAAe,GAAY,KAAK,CAAC;oBAEjC,uBAAkB,GAAY,KAAK,CAAC;oBAGxC,OAAO,CAAC,GAAG,CAAC,0CAA0C,EAAE,EAAE,CAAC,CAAC;gBAChE,CAAC;gBAED;;mBAEG;gBACH,uDAAgB,GAAhB,UAAiB,MAAM;oBACnB,IAAI,CAAC,eAAe,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC;gBACjD,CAAC;gBAED;;mBAEG;gBACH,iDAAU,GAAV;oBACI,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;gBAChC,CAAC;gBAED;;mBAEG;gBACH,2DAAoB,GAApB,UAAqB,MAAM;oBACvB,IAAI,CAAC,kBAAkB,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC;gBACvD,CAAC;gBA9BD;oBAAC,YAAK,EAAE;;wFAAA;gBAVZ;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,uBAAuB;wBACjC,QAAQ,EAAE,YAAY;wBACtB,UAAU,EAAE,CAAC,0DAA0B,CAAC;wBACxC,WAAW,EAAE,wCAAwC;wBACrD,SAAS,EAAE,CAAC,uCAAuC,CAAC;wBACpD,IAAI,EAAE,EAAC,qBAAqB,EAAE,kBAAkB,EAAC;qBACpD,CAAC;;gDAAA;gBAkCF,mCAAC;YAAD,CAAC,AAjCD,IAiCC;YAjCD,uEAiCC,CAAA"} \ No newline at end of file +{"version":3,"file":"file-uploading-dialog.component.js","sourceRoot":"","sources":["file-uploading-dialog.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;YAUH;;;;;;;;;;eAUG;YAUH;gBASI,sCAAmB,EAAc;oBAAd,OAAE,GAAF,EAAE,CAAY;oBAJzB,oBAAe,GAAY,KAAK,CAAC;oBAEjC,uBAAkB,GAAY,KAAK,CAAC;oBAGxC,OAAO,CAAC,GAAG,CAAC,0CAA0C,EAAE,EAAE,CAAC,CAAC;gBAChE,CAAC;gBAED;;mBAEG;gBACH,uDAAgB,GAAhB,UAAiB,MAAM;oBACnB,IAAI,CAAC,eAAe,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC;gBACjD,CAAC;gBAED;;mBAEG;gBACH,iDAAU,GAAV;oBACI,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;gBAChC,CAAC;gBAED;;mBAEG;gBACH,2DAAoB,GAApB,UAAqB,MAAM;oBACvB,IAAI,CAAC,kBAAkB,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC;gBACvD,CAAC;gBA9BD;oBAAC,YAAK,EAAE;;wFAAA;gBAXZ;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,uBAAuB;wBACjC,QAAQ,EAAE,YAAY;wBACtB,UAAU,EAAE,CAAC,0DAA0B,CAAC;wBACxC,WAAW,EAAE,wCAAwC;wBACrD,SAAS,EAAE,CAAC,uCAAuC,CAAC;wBACpD,IAAI,EAAE,EAAC,qBAAqB,EAAE,kBAAkB,EAAC;wBACjD,KAAK,EAAE,CAAC,6BAAa,CAAC;qBACzB,CAAC;;gDAAA;gBAkCF,mCAAC;YAAD,CAAC,AAjCD,IAiCC;YAjCD,uEAiCC,CAAA"} \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.ts b/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.ts index f96b31127c..4352e56559 100644 --- a/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.ts +++ b/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.ts @@ -19,6 +19,7 @@ import {Component, ElementRef, Input} from 'angular2/core'; import {FileModel} from '../models/file.model'; import {FileUploadingListComponent} from './file-uploading-list.component'; +import {TranslateService, TranslatePipe} from 'ng2-translate/ng2-translate'; declare let __moduleName: string; @@ -39,7 +40,8 @@ declare let __moduleName: string; directives: [FileUploadingListComponent], templateUrl: './file-uploading-dialog.component.html', styleUrls: ['./file-uploading-dialog.component.css'], - host: {'[class.dialog-show]': 'toggleShowDialog'} + host: {'[class.dialog-show]': 'toggleShowDialog'}, + pipes: [TranslatePipe] }) export class FileUploadingDialogComponent { diff --git a/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.html b/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.html index 95135c00ec..0bc2d2ca93 100644 --- a/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.html +++ b/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.html @@ -1,7 +1,7 @@
- file_upload Upload File + file_upload {{'FILE_UPLOAD.BUTTON.UPLOAD_FILE' | translate}} @@ -23,7 +23,7 @@
- file_upload Upload Folder + file_upload {{'FILE_UPLOAD.BUTTON.UPLOAD_FOLDER' | translate}} { uploadingFileModel.setAbort(); }); }, - actionText: 'Undo' + actionText: this.translate.get('FILE_UPLOAD.ACTION.UNDO').value }); } @@ -140,4 +147,18 @@ export class UploadButtonComponent { private _showDialog(): void { this.fileUploadingDialogComponent.showDialog(); } + + /** + * Initial configuration for Multi language + * @param translate + */ + translationInit(translate: TranslateService) { + this.translate = translate; + let userLang = navigator.language.split('-')[0]; // use navigator lang if available + userLang = /(fr|en)/gi.test(userLang) ? userLang : 'en'; + + this.translate.setDefaultLang(userLang); + + this.translate.use(userLang); + } }