mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-13 01:56:55 -07:00
Localize TV requests messages on TV details page
This commit is contained in:
parent
6756ee688a
commit
fc202f5337
6 changed files with 27 additions and 21 deletions
|
@ -70,7 +70,7 @@ namespace Ombi.Core.Senders
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new SenderResult { Success = false, Sent = false, Message = "Something went wrong!" };
|
return new SenderResult { Success = false, Sent = false };
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<SenderResult> SendToLidarr(AlbumRequest model, LidarrSettings settings)
|
private async Task<SenderResult> SendToLidarr(AlbumRequest model, LidarrSettings settings)
|
||||||
|
|
|
@ -133,8 +133,7 @@ namespace Ombi.Core.Senders
|
||||||
|
|
||||||
return new SenderResult
|
return new SenderResult
|
||||||
{
|
{
|
||||||
Success = false,
|
Success = false
|
||||||
Message = "Something went wrong!"
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ export class TvRequestGridComponent {
|
||||||
// Make sure something has been selected
|
// Make sure something has been selected
|
||||||
const selected = this.selection.hasValue();
|
const selected = this.selection.hasValue();
|
||||||
if (!selected && !this.tv.requestAll && !this.tv.firstSeason && !this.tv.latestSeason) {
|
if (!selected && !this.tv.requestAll && !this.tv.firstSeason && !this.tv.latestSeason) {
|
||||||
this.notificationService.send("You need to select some episodes!", "OK");
|
this.notificationService.send(this.translate.instant("Requests.NeedToSelectEpisodes"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { MatDialog } from "@angular/material/dialog";
|
||||||
import { MessageService } from "../../../../../services";
|
import { MessageService } from "../../../../../services";
|
||||||
import { RequestService } from "../../../../../services/request.service";
|
import { RequestService } from "../../../../../services/request.service";
|
||||||
import { RequestServiceV2 } from "../../../../../services/requestV2.service";
|
import { RequestServiceV2 } from "../../../../../services/requestV2.service";
|
||||||
|
import { TranslateService } from "@ngx-translate/core";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: "./tv-requests-panel.component.html",
|
templateUrl: "./tv-requests-panel.component.html",
|
||||||
|
@ -24,7 +25,8 @@ export class TvRequestsPanelComponent {
|
||||||
constructor(private requestService: RequestService,
|
constructor(private requestService: RequestService,
|
||||||
private requestService2: RequestServiceV2,
|
private requestService2: RequestServiceV2,
|
||||||
private messageService: MessageService,
|
private messageService: MessageService,
|
||||||
public dialog: MatDialog) {
|
public dialog: MatDialog,
|
||||||
|
private translateService: TranslateService) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +43,7 @@ export class TvRequestsPanelComponent {
|
||||||
ep.approved = true;
|
ep.approved = true;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.messageService.send("Request has been approved", "Ok");
|
this.messageService.send(this.translateService.instant("Requests.SuccessfullyApproved"));
|
||||||
} else {
|
} else {
|
||||||
this.messageService.sendRequestEngineResultError(result);
|
this.messageService.sendRequestEngineResultError(result);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +54,7 @@ export class TvRequestsPanelComponent {
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
this.tvRequest.splice(this.tvRequest.indexOf(request),1);
|
this.tvRequest.splice(this.tvRequest.indexOf(request),1);
|
||||||
this.messageService.send("Request has been Deleted", "Ok");
|
this.messageService.send(this.translateService.instant("Requests.SuccessfullyDeleted"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,9 +69,9 @@ export class TvRequestsPanelComponent {
|
||||||
this.requestService.markTvAvailable({ id: request.id }).subscribe(x => {
|
this.requestService.markTvAvailable({ id: request.id }).subscribe(x => {
|
||||||
if (x.result) {
|
if (x.result) {
|
||||||
this.messageService.send(
|
this.messageService.send(
|
||||||
`This request is now available`);
|
this.translateService.instant("Requests.NowAvailable"));
|
||||||
} else {
|
} else {
|
||||||
this.messageService.send("Request Available", x.message ? x.message : x.errorMessage);
|
this.messageService.sendRequestEngineResultError(x);
|
||||||
request.approved = false;
|
request.approved = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -77,9 +79,9 @@ export class TvRequestsPanelComponent {
|
||||||
this.requestService.markTvUnavailable({ id: request.id }).subscribe(x => {
|
this.requestService.markTvUnavailable({ id: request.id }).subscribe(x => {
|
||||||
if (x.result) {
|
if (x.result) {
|
||||||
this.messageService.send(
|
this.messageService.send(
|
||||||
`This request is now unavailable`);
|
this.translateService.instant("Requests.NowUnavailable"));
|
||||||
} else {
|
} else {
|
||||||
this.messageService.send("Request Available", x.message ? x.message : x.errorMessage);
|
this.messageService.sendRequestEngineResultError(x);
|
||||||
request.approved = false;
|
request.approved = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -102,11 +104,11 @@ export class TvRequestsPanelComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public reProcessRequest(request: IChildRequests) {
|
public reProcessRequest(request: IChildRequests) {
|
||||||
this.requestService2.reprocessRequest(request.id, RequestType.tvShow, false).subscribe(result => {
|
this.requestService2.reprocessRequest(request.id, RequestType.tvShow, false).subscribe(x => {
|
||||||
if (result.result) {
|
if (x.result) {
|
||||||
this.messageService.send(result.message ? result.message : "Successfully Re-processed the request", "Ok");
|
this.messageService.send(this.translateService.instant("Requests.SuccessfullyReprocessed"));
|
||||||
} else {
|
} else {
|
||||||
this.messageService.sendRequestEngineResultError(result);
|
this.messageService.sendRequestEngineResultError(x);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,11 +22,15 @@ export class MessageService {
|
||||||
}
|
}
|
||||||
public sendRequestEngineResultError(result: IRequestEngineResult, action: string = "Ok") {
|
public sendRequestEngineResultError(result: IRequestEngineResult, action: string = "Ok") {
|
||||||
const textKey = 'Requests.ErrorCodes.' + result.errorCode;
|
const textKey = 'Requests.ErrorCodes.' + result.errorCode;
|
||||||
const text = this.translate.instant(textKey);
|
var text = this.translate.instant(textKey);
|
||||||
if (text !== textKey) {
|
if (text === textKey) { // Error code on backend may not exist in frontend
|
||||||
this.send(text, action);
|
if (result.errorMessage || result.message) {
|
||||||
} else {
|
text = result.errorMessage ? result.errorMessage : result.message;
|
||||||
this.send(result.errorMessage ? result.errorMessage : result.message, action);
|
} else {
|
||||||
|
text = this.translate.instant('ErrorPages.SomethingWentWrong');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.send(text, action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,8 @@
|
||||||
"CheckPageForUpdates": "Check this page for continuous site updates."
|
"CheckPageForUpdates": "Check this page for continuous site updates."
|
||||||
},
|
},
|
||||||
"ErrorPages": {
|
"ErrorPages": {
|
||||||
"NotFound": "Page not found"
|
"NotFound": "Page not found",
|
||||||
|
"SomethingWentWrong": "Something went wrong!"
|
||||||
},
|
},
|
||||||
"NavigationBar": {
|
"NavigationBar": {
|
||||||
"Discover": "Discover",
|
"Discover": "Discover",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue