From 218f5d8716ebc80afb3392d8aede2584efd3174b Mon Sep 17 00:00:00 2001
From: Florian Dupret <34862846+sephrat@users.noreply.github.com>
Date: Tue, 19 Oct 2021 13:13:41 +0200
Subject: [PATCH] Localize collections and movie requests/popups
---
.../components/card/discover-card.component.ts | 4 ++--
.../discover-collections.component.html | 3 +--
.../discover-collections.component.ts | 6 ++++--
.../components/movie/movie-details.component.ts | 16 +++++++++-------
.../shared/deny-dialog/deny-dialog.component.ts | 6 ++++--
src/Ombi/wwwroot/translations/en.json | 7 +++++++
6 files changed, 27 insertions(+), 15 deletions(-)
diff --git a/src/Ombi/ClientApp/src/app/discover/components/card/discover-card.component.ts b/src/Ombi/ClientApp/src/app/discover/components/card/discover-card.component.ts
index a39e92858..0907404a8 100644
--- a/src/Ombi/ClientApp/src/app/discover/components/card/discover-card.component.ts
+++ b/src/Ombi/ClientApp/src/app/discover/components/card/discover-card.component.ts
@@ -130,7 +130,7 @@ export class DiscoverCardComponent implements OnInit {
rootFolderOverride: result.radarrFolderId, }).subscribe(x => {
if (x.result) {
this.result.requested = true;
- this.messageService.send(x.message, "Ok");
+ this.messageService.send(this.translate.instant("Requests.RequestAddedSuccessfully", { title: this.result.title }), "Ok");
} else {
this.messageService.send(x.errorMessage, "Ok");
}
@@ -141,7 +141,7 @@ export class DiscoverCardComponent implements OnInit {
this.requestService.requestMovie({ theMovieDbId: +this.result.id, languageCode: null, requestOnBehalf: null, qualityPathOverride: null, rootFolderOverride: null }).subscribe(x => {
if (x.result) {
this.result.requested = true;
- this.messageService.send(x.message, "Ok");
+ this.messageService.send(this.translate.instant("Requests.RequestAddedSuccessfully", { title: this.result.title }), "Ok");
} else {
this.messageService.send(x.errorMessage, "Ok");
}
diff --git a/src/Ombi/ClientApp/src/app/discover/components/collections/discover-collections.component.html b/src/Ombi/ClientApp/src/app/discover/components/collections/discover-collections.component.html
index 6c892fae6..23a7791f0 100644
--- a/src/Ombi/ClientApp/src/app/discover/components/collections/discover-collections.component.html
+++ b/src/Ombi/ClientApp/src/app/discover/components/collections/discover-collections.component.html
@@ -7,8 +7,7 @@
diff --git a/src/Ombi/ClientApp/src/app/discover/components/collections/discover-collections.component.ts b/src/Ombi/ClientApp/src/app/discover/components/collections/discover-collections.component.ts
index b4147f04e..4b5c93b05 100644
--- a/src/Ombi/ClientApp/src/app/discover/components/collections/discover-collections.component.ts
+++ b/src/Ombi/ClientApp/src/app/discover/components/collections/discover-collections.component.ts
@@ -1,6 +1,7 @@
import { Component, OnInit } from "@angular/core";
import { MessageService, SearchV2Service } from "../../../services";
+import { TranslateService } from "@ngx-translate/core";
import { ActivatedRoute } from "@angular/router";
import { AuthService } from "../../../auth/auth.service";
import { IDiscoverCardResult } from "../../interfaces";
@@ -25,7 +26,8 @@ export class DiscoverCollectionsComponent implements OnInit {
private route: ActivatedRoute,
private requestServiceV2: RequestServiceV2,
private messageService: MessageService,
- private auth: AuthService) {
+ private auth: AuthService,
+ private translate: TranslateService) {
this.route.params.subscribe((params: any) => {
this.collectionId = params.collectionId;
});
@@ -42,7 +44,7 @@ export class DiscoverCollectionsComponent implements OnInit {
this.loading();
this.requestServiceV2.requestMovieCollection(this.collectionId).subscribe(result => {
if (result.result) {
- this.messageService.send(result.message);
+ this.messageService.send(this.translate.instant("Requests.CollectionSuccesfullyAdded", { name: this.collection.name }));
} else {
this.messageService.send(result.errorMessage);
}
diff --git a/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.ts b/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.ts
index 9cb446656..ea9b24b1d 100644
--- a/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.ts
+++ b/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.ts
@@ -9,6 +9,7 @@ import { AuthService } from "../../../auth/auth.service";
import { IMovieRequests, RequestType, IAdvancedData } from "../../../interfaces";
import { DenyDialogComponent } from "../shared/deny-dialog/deny-dialog.component";
import { NewIssueComponent } from "../shared/new-issue/new-issue.component";
+import { TranslateService } from "@ngx-translate/core";
import { MovieAdvancedOptionsComponent } from "./panels/movie-advanced-options/movie-advanced-options.component";
import { RequestServiceV2 } from "../../../services/requestV2.service";
import { RequestBehalfComponent } from "../shared/request-behalf/request-behalf.component";
@@ -39,7 +40,8 @@ export class MovieDetailsComponent {
private sanitizer: DomSanitizer, private imageService: ImageService,
public dialog: MatDialog, private requestService: RequestService,
private requestService2: RequestServiceV2, private radarrService: RadarrService,
- public messageService: MessageService, private auth: AuthService, private settingsState: SettingsStateService) {
+ public messageService: MessageService, private auth: AuthService, private settingsState: SettingsStateService,
+ private translate: TranslateService) {
this.route.params.subscribe(async (params: any) => {
if (typeof params.movieDbId === 'string' || params.movieDbId instanceof String) {
if (params.movieDbId.startsWith("tt")) {
@@ -97,7 +99,7 @@ export class MovieDetailsComponent {
if (requestResult.result) {
this.movie.requested = true;
this.movie.requestId = requestResult.requestId;
- this.messageService.send(requestResult.message, "Ok");
+ this.messageService.send(this.translate.instant("Requests.RequestAddedSuccessfully", { title: this.movie.title }), "Ok");
this.movieRequest = await this.requestService.getMovieRequest(this.movie.requestId);
} else {
this.messageService.send(requestResult.errorMessage, "Ok");
@@ -110,7 +112,7 @@ export class MovieDetailsComponent {
this.movie.requested = true;
this.movie.requestId = result.requestId;
this.movieRequest = await this.requestService.getMovieRequest(this.movie.requestId);
- this.messageService.send(result.message, "Ok");
+ this.messageService.send(this.translate.instant("Requests.RequestAddedSuccessfully", { title: this.movie.title }), "Ok");
} else {
this.messageService.send(result.errorMessage, "Ok");
}
@@ -151,7 +153,7 @@ export class MovieDetailsComponent {
this.movie.approved = true;
const result = await this.requestService.approveMovie({ id: this.movieRequest.id }).toPromise();
if (result.result) {
- this.messageService.send("Successfully Approved", "Ok");
+ this.messageService.send(this.translate.instant("Requests.SuccessfullyApproved"), "Ok");
} else {
this.movie.approved = false;
this.messageService.send(result.errorMessage, "Ok");
@@ -162,7 +164,7 @@ export class MovieDetailsComponent {
const result = await this.requestService.markMovieAvailable({ id: this.movieRequest.id }).toPromise();
if (result.result) {
this.movie.available = true;
- this.messageService.send(result.message, "Ok");
+ this.messageService.send(this.translate.instant("Requests.NowAvailable"), "Ok");
} else {
this.messageService.send(result.errorMessage, "Ok");
}
@@ -173,7 +175,7 @@ export class MovieDetailsComponent {
const result = await this.requestService.markMovieUnavailable({ id: this.movieRequest.id }).toPromise();
if (result.result) {
this.movie.available = false;
- this.messageService.send(result.message, "Ok");
+ this.messageService.send(this.translate.instant("Requests.NowUnavailable"), "Ok");
} else {
this.messageService.send(result.errorMessage, "Ok");
}
@@ -204,7 +206,7 @@ export class MovieDetailsComponent {
public reProcessRequest() {
this.requestService2.reprocessRequest(this.movieRequest.id, RequestType.movie).subscribe(result => {
if (result.result) {
- this.messageService.send(result.message ? result.message : "Successfully Re-processed the request", "Ok");
+ this.messageService.send(result.message ? result.message : this.translate.instant("Requests.SuccessfullyReprocessed"), "Ok");
} else {
this.messageService.send(result.errorMessage, "Ok");
}
diff --git a/src/Ombi/ClientApp/src/app/media-details/components/shared/deny-dialog/deny-dialog.component.ts b/src/Ombi/ClientApp/src/app/media-details/components/shared/deny-dialog/deny-dialog.component.ts
index 4e6257b3f..2970c142b 100644
--- a/src/Ombi/ClientApp/src/app/media-details/components/shared/deny-dialog/deny-dialog.component.ts
+++ b/src/Ombi/ClientApp/src/app/media-details/components/shared/deny-dialog/deny-dialog.component.ts
@@ -2,6 +2,7 @@ import { Component, Inject } from "@angular/core";
import { IDenyDialogData } from "../interfaces/interfaces";
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog";
import { RequestService, MessageService } from "../../../../services";
+import { TranslateService } from "@ngx-translate/core";
import { RequestType, IRequestEngineResult } from "../../../../interfaces";
@Component({
@@ -13,7 +14,8 @@ export class DenyDialogComponent {
public dialogRef: MatDialogRef,
@Inject(MAT_DIALOG_DATA) public data: IDenyDialogData,
private requestService: RequestService,
- public messageService: MessageService) {}
+ public messageService: MessageService,
+ private translate: TranslateService) {}
public denyReason: string;
@@ -30,7 +32,7 @@ export class DenyDialogComponent {
}
if (result.result) {
- this.messageService.send("Denied Request", "Ok");
+ this.messageService.send(this.translate.instant("Requests.DeniedRequest"), "Ok");
this.data.denied = true;
} else {
this.messageService.send(result.errorMessage, "Ok");
diff --git a/src/Ombi/wwwroot/translations/en.json b/src/Ombi/wwwroot/translations/en.json
index e27d1564d..643f00d37 100644
--- a/src/Ombi/wwwroot/translations/en.json
+++ b/src/Ombi/wwwroot/translations/en.json
@@ -195,6 +195,13 @@
"Deleted": "Successfully deleted selected items",
"Approved": "Successfully approved selected items"
},
+ "SuccessfullyApproved": "Successfully Approved",
+ "NowAvailable": "Request is now available",
+ "NowUnavailable": "Request is now unavailable",
+ "SuccessfullyReprocessed": "Successfully Re-processed the request",
+ "DeniedRequest": "Denied Request",
+ "RequestCollection": "Request Collection",
+ "CollectionSuccesfullyAdded": "The collection {{name}} has been successfully added!",
"NeedToSelectEpisodes": "You need to select some episodes!",
"RequestAddedSuccessfully": "Request for {{title}} has been added successfully"
},