diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable.component.html b/ng2-components/ng2-alfresco-datatable/src/components/datatable.component.html
index d7e3dd9bbb..c1a95d40d3 100644
--- a/ng2-components/ng2-alfresco-datatable/src/components/datatable.component.html
+++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable.component.html
@@ -47,7 +47,7 @@
[context-menu]="getContextMenuActions(row, col)">
{{asIconValue(row, col)}}
-
}})
+
{{data.getValue(row, col)}}
diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable.component.spec.ts b/ng2-components/ng2-alfresco-datatable/src/components/datatable.component.spec.ts
index 81f4bc0c58..19be5990c6 100644
--- a/ng2-components/ng2-alfresco-datatable/src/components/datatable.component.spec.ts
+++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable.component.spec.ts
@@ -298,6 +298,12 @@ describe('DataTable', () => {
expect(dataTable.asIconValue(
row, column)).toBe(null);
});
+ it('should parse icon values to a valid i18n key', () => {
+ expect(dataTable.iconAltTextKey('custom')).toBe('ICONS.custom');
+ expect(dataTable.iconAltTextKey('/path/to/custom')).toBe('ICONS.custom');
+ expect(dataTable.iconAltTextKey('/path/to/custom.svg')).toBe('ICONS.custom');
+ });
+
it('should require column and direction to evaluate sorting state', () => {
expect(dataTable.isColumnSorted(null, null)).toBeFalsy();
expect(dataTable.isColumnSorted( {}, null)).toBeFalsy();
diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable.component.ts b/ng2-components/ng2-alfresco-datatable/src/components/datatable.component.ts
index 4d9b47b242..8c6533544c 100644
--- a/ng2-components/ng2-alfresco-datatable/src/components/datatable.component.ts
+++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable.component.ts
@@ -26,7 +26,10 @@ import {
TemplateRef
} from '@angular/core';
-import { CONTEXT_MENU_DIRECTIVES } from 'ng2-alfresco-core';
+import {
+ CONTEXT_MENU_DIRECTIVES,
+ AlfrescoPipeTranslate
+} from 'ng2-alfresco-core';
import {
DataTableAdapter,
@@ -45,7 +48,8 @@ declare let __moduleName: string;
selector: 'alfresco-datatable',
styleUrls: ['./datatable.component.css'],
templateUrl: './datatable.component.html',
- directives: [CONTEXT_MENU_DIRECTIVES]
+ directives: [CONTEXT_MENU_DIRECTIVES],
+ pipes: [AlfrescoPipeTranslate]
})
export class DataTableComponent implements OnInit, AfterViewChecked {
@@ -166,6 +170,10 @@ export class DataTableComponent implements OnInit, AfterViewChecked {
return null;
}
+ iconAltTextKey(value: string) {
+ return 'ICONS.' + value.substring(value.lastIndexOf('/') + 1).replace(/\.[a-z]+/, '');
+ }
+
isColumnSorted(col: DataColumn, direction: string) {
if (col && direction) {
let sorting = this.data.getSorting();
diff --git a/ng2-components/ng2-alfresco-documentlist/i18n/en.json b/ng2-components/ng2-alfresco-documentlist/i18n/en.json
new file mode 100644
index 0000000000..438f30d237
--- /dev/null
+++ b/ng2-components/ng2-alfresco-documentlist/i18n/en.json
@@ -0,0 +1,16 @@
+{
+ "ICONS": {
+ "ft_ic_folder": "Folder",
+ "ft_ic_raster_image": "Image file",
+ "ft_ic_pdf": "PDF document",
+ "ft_ic_ms_excel": "Microsoft Excel file",
+ "ft_ic_ms_word": "Microsoft Word document",
+ "ft_ic_ms_powerpoint": "Microsoft PowerPoint file",
+ "ft_ic_video": "Video file",
+ "ft_ic_document": "Document file",
+ "ft_ic_website": "Web resource",
+ "ft_ic_archive": "Archive file",
+ "ft_ic_presentation": "Presentation file",
+ "ft_ic_spreadsheet": "Spreadsheet file"
+ }
+}
diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.spec.ts
index aad08a8088..b48339a5c8 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.spec.ts
+++ b/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.spec.ts
@@ -96,7 +96,7 @@ describe('DocumentListBreadcrumb', () => {
});
it('should update document list on click', () => {
- let documentList = new DocumentList(null, null);
+ let documentList = new DocumentList(null, null, null);
spyOn(documentList, 'displayFolderContent').and.stub();
let node = { name: 'name', path: '/path' };
diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/content-action-list.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/content-action-list.spec.ts
index b7572ee969..3820af672c 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/components/content-action-list.spec.ts
+++ b/ng2-components/ng2-alfresco-documentlist/src/components/content-action-list.spec.ts
@@ -34,7 +34,7 @@ describe('ContentColumnList', () => {
beforeEach(() => {
let documentListService = new DocumentListServiceMock();
- documentList = new DocumentList(documentListService, null);
+ documentList = new DocumentList(documentListService, null, null);
actionList = new ContentActionList(documentList);
});
diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/content-action.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/content-action.spec.ts
index 59b473841f..1216d78b01 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/components/content-action.spec.ts
+++ b/ng2-components/ng2-alfresco-documentlist/src/components/content-action.spec.ts
@@ -44,7 +44,7 @@ describe('ContentAction', () => {
documentActions = new DocumentActionsService(null, null);
folderActions = new FolderActionsService(null);
- documentList = new DocumentList(documentServiceMock, null);
+ documentList = new DocumentList(documentServiceMock, null, null);
actionList = new ContentActionList(documentList);
});
diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/content-column-list.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/content-column-list.spec.ts
index 084f7c0ca3..76c4952e85 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/components/content-column-list.spec.ts
+++ b/ng2-components/ng2-alfresco-documentlist/src/components/content-column-list.spec.ts
@@ -35,7 +35,7 @@ describe('ContentColumnList', () => {
beforeEach(() => {
let service = new DocumentListServiceMock();
- documentList = new DocumentList(service, null);
+ documentList = new DocumentList(service, null, null);
columnList = new ContentColumnList(documentList);
});
diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/content-column.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/content-column.spec.ts
index ab9d4dab78..4f07ad7815 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/components/content-column.spec.ts
+++ b/ng2-components/ng2-alfresco-documentlist/src/components/content-column.spec.ts
@@ -34,7 +34,7 @@ describe('ContentColumn', () => {
beforeEach(() => {
let service = new DocumentListServiceMock();
- documentList = new DocumentList(service, null);
+ documentList = new DocumentList(service, null, null);
columnList = new ContentColumnList(documentList);
});
diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.spec.ts
index 2454bb327d..d0ea193190 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.spec.ts
+++ b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.spec.ts
@@ -34,7 +34,7 @@ describe('DocumentList', () => {
beforeEach(() => {
documentListService = new DocumentListServiceMock();
let zone = new NgZone(false);
- documentList = new DocumentList(documentListService, zone);
+ documentList = new DocumentList(documentListService, zone, null);
eventMock = {
preventDefault: function () {
diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts
index 65568ef122..9bfd884fae 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts
+++ b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts
@@ -31,7 +31,10 @@ import {
HostListener
} from '@angular/core';
import { Subject } from 'rxjs/Rx';
-import { CONTEXT_MENU_DIRECTIVES } from 'ng2-alfresco-core';
+import {
+ CONTEXT_MENU_DIRECTIVES,
+ AlfrescoTranslationService
+} from 'ng2-alfresco-core';
import {
ALFRESCO_DATATABLE_DIRECTIVES,
@@ -127,9 +130,14 @@ export class DocumentList implements OnInit, AfterViewInit, AfterViewChecked, Af
constructor(
private documentListService: DocumentListService,
- private ngZone: NgZone) {
+ private ngZone: NgZone,
+ private translate: AlfrescoTranslationService) {
this.data = new ShareDataTableAdapter(this.documentListService, this.baseComponentPath, []);
+
+ if (translate) {
+ translate.addTranslationFolder('node_modules/ng2-alfresco-documentlist');
+ }
}
getContextActions(node: MinimalNodeEntity) {