From 62fe41478420a5d9c564fd4a3d2fa4b0fbd61c67 Mon Sep 17 00:00:00 2001 From: Dominik Chrastecky Date: Thu, 21 Sep 2023 22:10:46 +0200 Subject: [PATCH] Translation: Translate notifications --- .../notification/notification.component.ts | 14 ++++++++++---- src/assets/i18n/en.json | 5 ++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/app/components/notification/notification.component.ts b/src/app/components/notification/notification.component.ts index a23e3d3..59b5f85 100644 --- a/src/app/components/notification/notification.component.ts +++ b/src/app/components/notification/notification.component.ts @@ -1,5 +1,6 @@ import {Component, EventEmitter, Input, Output} from '@angular/core'; -import {Observable, of} from "rxjs"; +import {Observable} from "rxjs"; +import {TranslatorService} from "../../services/translator.service"; export enum NotificationType { Error, @@ -22,6 +23,11 @@ export class NotificationComponent { @Output() deleted: Observable = new EventEmitter(); + constructor( + private readonly translator: TranslatorService, + ) { + } + public async remove(): Promise { this.isDeleted = true; @@ -31,11 +37,11 @@ export class NotificationComponent { public get title(): Observable { switch (this.kind) { case NotificationType.Error: - return of('Error'); + return this.translator.get('notification.error'); case NotificationType.Success: - return of('Success'); + return this.translator.get('notification.success'); case NotificationType.Warning: - return of('Warning'); + return this.translator.get('notification.warning'); } } } diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 7f6dfe9..6721d7c 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -105,5 +105,8 @@ "app.glossary.hesitation.paragraph_2": "An instance can hesitate on any number of instances and be hesitated on by any number of instances.", "app.suspicious_instance": "Suspicious instance", "app.glossary.suspicious_instance.paragraph_1": "A suspicious instance is one that's algorithmically determined to be suspicious due to the ratio of active users count and the amount of posts.", - "app.glossary.suspicious_instance.paragraph_2": "The api allows tweaking the parameters to report those instances, support for this feature is coming to this GUI at a later time." + "app.glossary.suspicious_instance.paragraph_2": "The api allows tweaking the parameters to report those instances, support for this feature is coming to this GUI at a later time.", + "notification.error": "Error", + "notification.success": "Success", + "notification.warning": "Warning" }