Kavita/UI/Web/src/app/_pipes/device-platform.pipe.ts
2023-11-04 10:29:10 -07:00

24 lines
727 B
TypeScript

import {inject, Pipe, PipeTransform} from '@angular/core';
import { DevicePlatform } from 'src/app/_models/device/device-platform';
import {TranslocoService} from "@ngneat/transloco";
@Pipe({
name: 'devicePlatform',
standalone: true
})
export class DevicePlatformPipe implements PipeTransform {
translocoService = inject(TranslocoService);
transform(value: DevicePlatform): string {
switch(value) {
case DevicePlatform.Kindle: return 'Kindle';
case DevicePlatform.Kobo: return 'Kobo';
case DevicePlatform.PocketBook: return 'PocketBook';
case DevicePlatform.Custom: return this.translocoService.translate('device-platform-pipe.custom');
default: return value + '';
}
}
}