Skip to content

Commit

Permalink
chore(igx-grid): Add conditions localization strings, #2517
Browse files Browse the repository at this point in the history
  • Loading branch information
sstoyanovIG committed Nov 12, 2018
1 parent 3c2c429 commit ab530ef
Show file tree
Hide file tree
Showing 3 changed files with 162 additions and 1 deletion.
26 changes: 26 additions & 0 deletions projects/igniteui-angular/src/lib/core/i18n/translate.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Pipe, PipeTransform, Inject } from '@angular/core';

export class ResourceStringsComponent {}

@Pipe({
name: 'translate',
pure: true
})
export class IgxTranslatePipe implements PipeTransform {
private language;

constructor(@Inject(ResourceStringsComponent) private resourceStrings: any) {
this.language = navigator.language.substring(0, 2);
}

public transform(value: string): string {
const rs = this.resourceStrings.find((x) => x.en === value);
if (this.language === 'jp') {
return rs.jp;
} else if (this.language === 'ko') {
return rs.ko;
} else {
return value;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[value]="condition"
[isSelected]="isConditionSelected(condition)">
<igx-icon fontSet="filtering-icons" [name]="getCondition(condition).iconName"></igx-icon>
<span style="margin-left: 16px">{{ condition | filterCondition | titlecase }}</span>
<span style="margin-left: 16px">{{ condition | filterCondition | titlecase | translate }}</span>
</igx-drop-down-item>
</igx-drop-down>

Expand Down
135 changes: 135 additions & 0 deletions projects/igniteui-angular/src/lib/grids/grid-resource-strings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
export const IgxGridResourceStrings = [
{
en: 'Filter',
jp: 'Filter',
ko: 'Filter'
}, {
en: 'Close',
jp: 'Close',
ko: 'Close'
}, {
en: 'Reset',
jp: 'Reset',
ko: 'Reset'
}, {
en: 'And',
jp: 'And',
ko: 'And'
}, {
en: 'Or',
jp: 'Or',
ko: 'Or'
}, {
en: 'Add filter value',
jp: 'Add filter value',
ko: 'Add filter value'
}, {
en: 'Contains',
jp: 'Contains',
ko: 'Contains'
}, {
en: 'Does Not Contain',
jp: 'Does Not Contain',
ko: 'Does Not Contain'
}, {
en: 'Starts With',
jp: 'Starts With',
ko: 'Starts With'
}, {
en: 'Ends With',
jp: 'Ends With',
ko: 'Ends With'
}, {
en: 'Equals',
jp: 'Equals',
ko: 'Equals'
}, {
en: 'Does Not Equal',
jp: 'Does Not Equal',
ko: 'Does Not Equal'
}, {
en: 'Empty',
jp: 'Empty',
ko: 'Empty'
}, {
en: 'Not Empty',
jp: 'Not Empty',
ko: 'Not Empty'
}, {
en: 'Null',
jp: 'Null',
ko: 'Null'
}, {
en: 'Not Null',
jp: 'Not Null',
ko: 'Not Null'
}, {
en: 'Greater Than',
jp: 'Greater Than',
ko: 'Greater Than'
}, {
en: 'Less Than',
jp: 'Less Than',
ko: 'Less Than'
}, {
en: 'Greater Than Or Equal To',
jp: 'Greater Than Or Equal To',
ko: 'Greater Than Or Equal To'
}, {
en: 'Less Than Or Equal To',
jp: 'Less Than Or Equal To',
ko: 'Less Than Or Equal To'
}, {
en: 'Before',
jp: 'Before',
ko: 'Before'
}, {
en: 'After',
jp: 'Afte',
ko: 'Afte'
}, {
en: 'Today',
jp: 'Today',
ko: 'Today'
}, {
en: 'Yesterday',
jp: 'Yesterday',
ko: 'Yesterday'
}, {
en: 'This Month',
jp: 'This Month',
ko: 'This Month'
}, {
en: 'Last Month',
jp: 'Last Month',
ko: 'Last Month'
}, {
en: 'Next Month',
jp: 'Next Month',
ko: 'Next Month'
}, {
en: 'This Year',
jp: 'This Year',
ko: 'This Year'
}, {
en: 'Last Year',
jp: 'Last Year',
ko: 'Last Year'
}, {
en: 'Next Year',
jp: 'Next Year',
ko: 'Next Year'
}, {
en: 'All',
jp: 'All',
ko: 'All'
}, {
en: 'True',
jp: 'True',
ko: 'True'
}, {
en: 'False',
jp: 'False',
ko: 'False'
}
];

0 comments on commit ab530ef

Please sign in to comment.