Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation: Translate notifications #96

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/app/components/notification/notification.component.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -22,6 +23,11 @@ export class NotificationComponent {

@Output() deleted: Observable<void> = new EventEmitter<void>();

constructor(
private readonly translator: TranslatorService,
) {
}


public async remove(): Promise<void> {
this.isDeleted = true;
Expand All @@ -31,11 +37,11 @@ export class NotificationComponent {
public get title(): Observable<string> {
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');
}
}
}
5 changes: 4 additions & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}