Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

1020 B
Raw Blame
import {Pipe, PipeTransform} from '@angular/core';
import { MangaFormat } from '../_models/manga-format';
import {TranslocoService} from "@ngneat/transloco";

/**
 * Returns the string name for the format
 */
@Pipe({
  name: 'mangaFormat',
  standalone: true
})
export class MangaFormatPipe implements PipeTransform {

  constructor(private translocoService: TranslocoService) {}

  transform(format: MangaFormat): string {
    switch (format) {
      case MangaFormat.EPUB:
        return this.translocoService.translate('manga-format-pipe.epub');
      case MangaFormat.ARCHIVE:
        return this.translocoService.translate('manga-format-pipe.archive');
      case MangaFormat.IMAGE:
        return this.translocoService.translate('manga-format-pipe.image');
      case MangaFormat.PDF:
        return this.translocoService.translate('manga-format-pipe.pdf');
      case MangaFormat.UNKNOWN:
        return this.translocoService.translate('manga-format-pipe.unknown');
      default:
        return '';
    }
  }

}