1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/frontend/app/pipes/StringifySortingMethod.ts

27 lines
785 B
TypeScript
Raw Normal View History

2018-05-29 02:03:12 +08:00
import {Pipe, PipeTransform} from '@angular/core';
import {I18n} from '@ngx-translate/i18n-polyfill';
import {SortingMethods} from '../../../common/entities/SortingMethods';
@Pipe({name: 'stringifySorting'})
export class StringifySortingMethod implements PipeTransform {
constructor(private i18n: I18n) {
}
transform(method: SortingMethods): string {
switch (method) {
case SortingMethods.ascName:
return this.i18n('ascending name');
case SortingMethods.descName:
return this.i18n('descending name');
case SortingMethods.ascDate:
return this.i18n('ascending date');
case SortingMethods.descDate:
return this.i18n('descending date');
2019-01-28 06:27:41 +08:00
case SortingMethods.random:
return this.i18n('random');
2018-05-29 02:03:12 +08:00
}
}
}