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>
|
</label>
|
||||||
<div [class]="getTextFieldHolderClassName()">
|
<div [class]="getTextFieldHolderClassName()">
|
||||||
<input class="mdl-textfield__input" [type]="inputType" [autocomplete]="getAutoComplete()" id="searchTerm" [ngFormControl]="searchControl" [(ngModel)]="searchTerm">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@@ -19,6 +19,8 @@ import { Control, Validators } from 'angular2/common';
|
|||||||
import { Component, Input, Output, EventEmitter } from 'angular2/core';
|
import { Component, Input, Output, EventEmitter } from 'angular2/core';
|
||||||
import { AlfrescoService } from './../services/alfresco.service';
|
import { AlfrescoService } from './../services/alfresco.service';
|
||||||
|
|
||||||
|
import { AlfrescoPipeTranslate, AlfrescoTranslationService } from 'ng2-alfresco-core/dist/ng2-alfresco-core';
|
||||||
|
|
||||||
declare let __moduleName: string;
|
declare let __moduleName: string;
|
||||||
declare var componentHandler: any;
|
declare var componentHandler: any;
|
||||||
|
|
||||||
@@ -28,7 +30,8 @@ declare var componentHandler: any;
|
|||||||
styles: [
|
styles: [
|
||||||
],
|
],
|
||||||
templateUrl: './alfresco-search-control.component.html',
|
templateUrl: './alfresco-search-control.component.html',
|
||||||
providers: [AlfrescoService]
|
providers: [AlfrescoService],
|
||||||
|
pipes: [AlfrescoPipeTranslate]
|
||||||
})
|
})
|
||||||
export class AlfrescoSearchControlComponent {
|
export class AlfrescoSearchControlComponent {
|
||||||
|
|
||||||
@@ -49,13 +52,14 @@ export class AlfrescoSearchControlComponent {
|
|||||||
|
|
||||||
searchControl: Control;
|
searchControl: Control;
|
||||||
|
|
||||||
constructor() {
|
constructor(private translate: AlfrescoTranslationService) {
|
||||||
|
|
||||||
this.searchControl = new Control(
|
this.searchControl = new Control(
|
||||||
this.searchTerm,
|
this.searchTerm,
|
||||||
Validators.compose([Validators.required, Validators.minLength(3)])
|
Validators.compose([Validators.required, Validators.minLength(3)])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
translate.addComponent('node_modules/ng2-alfresco-search');
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
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">
|
<table *ngIf="searchTerm && results.length" class="mdl-data-table mdl-js-data-table mdl-shadow--2dp full-width">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -6,13 +6,13 @@
|
|||||||
<span class="mdl-data-table__cell--non-numeric"></span>
|
<span class="mdl-data-table__cell--non-numeric"></span>
|
||||||
</th>
|
</th>
|
||||||
<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>
|
||||||
<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>
|
||||||
<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>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@@ -19,6 +19,8 @@ import { Component, Input, Optional, OnChanges, OnInit } from 'angular2/core';
|
|||||||
import { RouteParams } from 'angular2/router';
|
import { RouteParams } from 'angular2/router';
|
||||||
import { AlfrescoService } from './../services/alfresco.service';
|
import { AlfrescoService } from './../services/alfresco.service';
|
||||||
|
|
||||||
|
import { AlfrescoPipeTranslate, AlfrescoTranslationService } from 'ng2-alfresco-core/dist/ng2-alfresco-core';
|
||||||
|
|
||||||
declare let __moduleName: string;
|
declare let __moduleName: string;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -27,7 +29,8 @@ declare let __moduleName: string;
|
|||||||
styles: [
|
styles: [
|
||||||
],
|
],
|
||||||
templateUrl: './alfresco-search.component.html',
|
templateUrl: './alfresco-search.component.html',
|
||||||
providers: [AlfrescoService]
|
providers: [AlfrescoService],
|
||||||
|
pipes: [AlfrescoPipeTranslate]
|
||||||
})
|
})
|
||||||
export class AlfrescoSearchComponent implements OnChanges, OnInit {
|
export class AlfrescoSearchComponent implements OnChanges, OnInit {
|
||||||
|
|
||||||
@@ -41,7 +44,12 @@ export class AlfrescoSearchComponent implements OnChanges, OnInit {
|
|||||||
route: any[] = [];
|
route: any[] = [];
|
||||||
|
|
||||||
constructor(
|
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 = [];
|
this.results = [];
|
||||||
if (params) {
|
if (params) {
|
||||||
this.searchTerm = params.get('q');
|
this.searchTerm = params.get('q');
|
||||||
|
Reference in New Issue
Block a user