find-language-from-key.pipe.ts 451B

1234567891011121314
  1. import { Pipe, PipeTransform } from '@angular/core';
  2. @Pipe({ name: 'findLanguageFromKey' })
  3. export class FindLanguageFromKeyPipe implements PipeTransform {
  4. private languages: any = {
  5. en: { name: 'English' },
  6. es: { name: 'Español' }
  7. // jhipster-needle-i18n-language-key-pipe - JHipster will add/remove languages in this object
  8. };
  9. transform(lang: string): string {
  10. return this.languages[lang].name;
  11. }
  12. }