mirror of
https://github.com/bitwarden/browser
synced 2026-02-13 06:54:07 +00:00
[CL-134] Use standalone components
This commit is contained in:
@@ -8,6 +8,7 @@ import { Directive, TemplateRef } from "@angular/core";
|
||||
*/
|
||||
@Directive({
|
||||
selector: "[bit-i18n-part]",
|
||||
standalone: true,
|
||||
})
|
||||
export class I18nPartDirective {
|
||||
constructor(public templateRef: TemplateRef<any>) {}
|
||||
|
||||
@@ -9,6 +9,8 @@ import {
|
||||
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
|
||||
import { SharedModule } from "../shared";
|
||||
|
||||
import { I18nPartDirective } from "./i18n-part.directive";
|
||||
|
||||
interface I18nStringPart {
|
||||
@@ -38,6 +40,7 @@ interface I18nStringPart {
|
||||
*/
|
||||
@Component({
|
||||
selector: "[bit-i18n],bit-i18n",
|
||||
imports: [SharedModule],
|
||||
template: `
|
||||
<ng-container *ngFor="let part of translationParts">
|
||||
<ng-container *ngIf="part.templateRef != undefined; else text">
|
||||
@@ -48,6 +51,7 @@ interface I18nStringPart {
|
||||
<ng-template #text>{{ part.text }}</ng-template>
|
||||
</ng-container>
|
||||
`,
|
||||
standalone: true,
|
||||
})
|
||||
export class I18nComponent implements AfterContentInit {
|
||||
@Input("key")
|
||||
|
||||
@@ -6,8 +6,7 @@ import { I18nPartDirective } from "./i18n-part.directive";
|
||||
import { I18nComponent } from "./i18n.component";
|
||||
|
||||
@NgModule({
|
||||
imports: [SharedModule],
|
||||
declarations: [I18nComponent, I18nPartDirective],
|
||||
imports: [SharedModule, I18nComponent, I18nPartDirective],
|
||||
exports: [I18nComponent, I18nPartDirective],
|
||||
})
|
||||
export class I18nModule {}
|
||||
|
||||
Reference in New Issue
Block a user