mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Add i18n to search components
This commit is contained in:
15
ng2-components/ng2-alfresco-search/i18n/en.json
Normal file
15
ng2-components/ng2-alfresco-search/i18n/en.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"SEARCH": {
|
||||
"CONTROL": {
|
||||
"LABEL": "Search content"
|
||||
},
|
||||
"RESULTS": {
|
||||
"SUMMARY": "Found {{numResults}} results for {{searchTerm}}",
|
||||
"COLUMNS": {
|
||||
"NAME": "Name",
|
||||
"MODIFIED_BY": "Modified by",
|
||||
"MODIFIED_AT": "Modified at"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,7 +5,7 @@
|
||||
</label>
|
||||
<div [class]="getTextFieldHolderClassName()">
|
||||
<input class="mdl-textfield__input" [type]="inputType" [autocomplete]="getAutoComplete()" id="searchTerm" [ngFormControl]="searchControl" [(ngModel)]="searchTerm">
|
||||
<label class="mdl-textfield__label" for="searchTerm">Search content</label>
|
||||
<label class="mdl-textfield__label" for="searchTerm">{{'SEARCH.CONTROL.LABEL' | translate}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@@ -19,6 +19,8 @@ import { Control, Validators } from 'angular2/common';
|
||||
import { Component, Input, Output, EventEmitter } from 'angular2/core';
|
||||
import { AlfrescoService } from './../services/alfresco.service';
|
||||
|
||||
import { AlfrescoPipeTranslate, AlfrescoTranslationService } from 'ng2-alfresco-core/dist/ng2-alfresco-core';
|
||||
|
||||
declare let __moduleName: string;
|
||||
declare var componentHandler: any;
|
||||
|
||||
@@ -28,7 +30,8 @@ declare var componentHandler: any;
|
||||
styles: [
|
||||
],
|
||||
templateUrl: './alfresco-search-control.component.html',
|
||||
providers: [AlfrescoService]
|
||||
providers: [AlfrescoService],
|
||||
pipes: [AlfrescoPipeTranslate]
|
||||
})
|
||||
export class AlfrescoSearchControlComponent {
|
||||
|
||||
@@ -49,13 +52,14 @@ export class AlfrescoSearchControlComponent {
|
||||
|
||||
searchControl: Control;
|
||||
|
||||
constructor() {
|
||||
constructor(private translate: AlfrescoTranslationService) {
|
||||
|
||||
this.searchControl = new Control(
|
||||
this.searchTerm,
|
||||
Validators.compose([Validators.required, Validators.minLength(3)])
|
||||
);
|
||||
|
||||
translate.addComponent('node_modules/ng2-alfresco-search');
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<p *ngIf="searchTerm">Found {{results.length}} results for {{searchTerm}}</p>
|
||||
<p *ngIf="searchTerm">{{ 'SEARCH.RESULTS.SUMMARY' | translate:{numResults: results.length, searchTerm: searchTerm} }}</p>
|
||||
<table *ngIf="searchTerm && results.length" class="mdl-data-table mdl-js-data-table mdl-shadow--2dp full-width">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -6,13 +6,13 @@
|
||||
<span class="mdl-data-table__cell--non-numeric"></span>
|
||||
</th>
|
||||
<th>
|
||||
<span class="mdl-data-table__cell--non-numeric">Name</span>
|
||||
<span class="mdl-data-table__cell--non-numeric">{{'SEARCH.RESULTS.COLUMNS.NAME' | translate}}</span>
|
||||
</th>
|
||||
<th>
|
||||
<span class="mdl-data-table__cell--non-numeric">Modified by</span>
|
||||
<span class="mdl-data-table__cell--non-numeric">{{'SEARCH.RESULTS.COLUMNS.MODIFIED_BY' | translate}}</span>
|
||||
</th>
|
||||
<th>
|
||||
<span class="mdl-data-table__cell--non-numeric">Modified at</span>
|
||||
<span class="mdl-data-table__cell--non-numeric">{{'SEARCH.RESULTS.COLUMNS.MODIFIED_AT' | translate}}</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@@ -19,6 +19,8 @@ import { Component, Input, Optional, OnChanges, OnInit } from 'angular2/core';
|
||||
import { RouteParams } from 'angular2/router';
|
||||
import { AlfrescoService } from './../services/alfresco.service';
|
||||
|
||||
import { AlfrescoPipeTranslate, AlfrescoTranslationService } from 'ng2-alfresco-core/dist/ng2-alfresco-core';
|
||||
|
||||
declare let __moduleName: string;
|
||||
|
||||
@Component({
|
||||
@@ -27,7 +29,8 @@ declare let __moduleName: string;
|
||||
styles: [
|
||||
],
|
||||
templateUrl: './alfresco-search.component.html',
|
||||
providers: [AlfrescoService]
|
||||
providers: [AlfrescoService],
|
||||
pipes: [AlfrescoPipeTranslate]
|
||||
})
|
||||
export class AlfrescoSearchComponent implements OnChanges, OnInit {
|
||||
|
||||
@@ -41,7 +44,12 @@ export class AlfrescoSearchComponent implements OnChanges, OnInit {
|
||||
route: any[] = [];
|
||||
|
||||
constructor(
|
||||
private _alfrescoService: AlfrescoService, @Optional() params: RouteParams) {
|
||||
private _alfrescoService: AlfrescoService,
|
||||
private translate: AlfrescoTranslationService,
|
||||
@Optional() params: RouteParams)
|
||||
{
|
||||
translate.addComponent('node_modules/ng2-alfresco-search');
|
||||
|
||||
this.results = [];
|
||||
if (params) {
|
||||
this.searchTerm = params.get('q');
|
||||
|
Reference in New Issue
Block a user