Files
start-os/web/projects/shared/src/i18n/i18n.pipe.ts
Matt Hill 8c977c51ca frontend fixes for alpha.2 (#2919)
* rmeove icon from toggles

* fix: comments

* fix: more comments

* always show public domains even if interface private, only show delete on domains

* fix: even more comments

* fix: last comments

* feat: empty state for dashboard

* rework welcome, dlete update-toast, minor

* translation improvements

---------

Co-authored-by: waterplea <alexander@inkin.ru>
2025-05-09 10:29:17 -06:00

22 lines
678 B
TypeScript

import { inject, Injectable, Pipe, PipeTransform } from '@angular/core'
import { ENGLISH } from './dictionaries/en'
import { I18N, i18nKey } from './i18n.providers'
@Pipe({
standalone: true,
name: 'i18n',
pure: false,
})
@Injectable({ providedIn: 'root' })
export class i18nPipe implements PipeTransform {
private readonly i18n = inject(I18N)
// @TODO uncomment to make sure translations are present
transform(englishKey: string | null | undefined): string | undefined {
// transform(englishKey: i18nKey | null | undefined): string | undefined {
return englishKey
? this.i18n()?.[ENGLISH[englishKey as i18nKey]] || englishKey
: undefined
}
}