mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
[PM-17031] Create UI-common (#12831)
Extract core functionality from `libs/angular` to allow teams to depend on `libs/ui-common` instead. Moves the following functionality to `ui-common`. - `I18nPipe`. `libs/angular` still has an old copy but `components` depends on the new variant from `ui-common`. - `safeProvider`, `SafeProvider` and `SafeInjectionToken`. `libs/angular`re-exports these to avoid needing to update all consumers.
This commit is contained in:
24
libs/ui/common/src/i18n.pipe.ts
Normal file
24
libs/ui/common/src/i18n.pipe.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Pipe, PipeTransform } from "@angular/core";
|
||||
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
|
||||
/**
|
||||
* Localizes the specified string.
|
||||
*
|
||||
* @example
|
||||
* {{ 'key' | i18n }}
|
||||
*
|
||||
* @example
|
||||
* {{ 'key' | i18n: 'param1' }}
|
||||
*/
|
||||
@Pipe({
|
||||
name: "i18n",
|
||||
standalone: true,
|
||||
})
|
||||
export class I18nPipe implements PipeTransform {
|
||||
constructor(private i18nService: I18nService) {}
|
||||
|
||||
transform(id: string, p1?: string, p2?: string, p3?: string): string {
|
||||
return this.i18nService.t(id, p1, p2, p3);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user