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)
|
||||
|
|
|
@ -133,8 +133,7 @@ namespace Ombi.Core.Senders
|
|||
|
||||
return new SenderResult
|
||||
{
|
||||
Success = false,
|
||||
Message = "Something went wrong!"
|
||||
Success = false
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ export class TvRequestGridComponent {
|
|||
// Make sure something has been selected
|
||||
const selected = this.selection.hasValue();
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import { MatDialog } from "@angular/material/dialog";
|
|||
import { MessageService } from "../../../../../services";
|
||||
import { RequestService } from "../../../../../services/request.service";
|
||||
import { RequestServiceV2 } from "../../../../../services/requestV2.service";
|
||||
import { TranslateService } from "@ngx-translate/core";
|
||||
|
||||
@Component({
|
||||
templateUrl: "./tv-requests-panel.component.html",
|
||||
|
@ -24,7 +25,8 @@ export class TvRequestsPanelComponent {
|
|||
constructor(private requestService: RequestService,
|
||||
private requestService2: RequestServiceV2,
|
||||
private messageService: MessageService,
|
||||
public dialog: MatDialog) {
|
||||
public dialog: MatDialog,
|
||||
private translateService: TranslateService) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -41,7 +43,7 @@ export class TvRequestsPanelComponent {
|
|||
ep.approved = true;
|
||||
});
|
||||
});
|
||||
this.messageService.send("Request has been approved", "Ok");
|
||||
this.messageService.send(this.translateService.instant("Requests.SuccessfullyApproved"));
|
||||
} else {
|
||||
this.messageService.sendRequestEngineResultError(result);
|
||||
}
|
||||
|
@ -52,7 +54,7 @@ export class TvRequestsPanelComponent {
|
|||
|
||||
if (result) {
|
||||
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 => {
|
||||
if (x.result) {
|
||||
this.messageService.send(
|
||||
`This request is now available`);
|
||||
this.translateService.instant("Requests.NowAvailable"));
|
||||
} else {
|
||||
this.messageService.send("Request Available", x.message ? x.message : x.errorMessage);
|
||||
this.messageService.sendRequestEngineResultError(x);
|
||||
request.approved = false;
|
||||
}
|
||||
});
|
||||
|
@ -77,9 +79,9 @@ export class TvRequestsPanelComponent {
|
|||
this.requestService.markTvUnavailable({ id: request.id }).subscribe(x => {
|
||||
if (x.result) {
|
||||
this.messageService.send(
|
||||
`This request is now unavailable`);
|
||||
this.translateService.instant("Requests.NowUnavailable"));
|
||||
} else {
|
||||
this.messageService.send("Request Available", x.message ? x.message : x.errorMessage);
|
||||
this.messageService.sendRequestEngineResultError(x);
|
||||
request.approved = false;
|
||||
}
|
||||
});
|
||||
|
@ -102,11 +104,11 @@ export class TvRequestsPanelComponent {
|
|||
}
|
||||
|
||||
public reProcessRequest(request: IChildRequests) {
|
||||
this.requestService2.reprocessRequest(request.id, RequestType.tvShow, false).subscribe(result => {
|
||||
if (result.result) {
|
||||
this.messageService.send(result.message ? result.message : "Successfully Re-processed the request", "Ok");
|
||||
this.requestService2.reprocessRequest(request.id, RequestType.tvShow, false).subscribe(x => {
|
||||
if (x.result) {
|
||||
this.messageService.send(this.translateService.instant("Requests.SuccessfullyReprocessed"));
|
||||
} else {
|
||||
this.messageService.sendRequestEngineResultError(result);
|
||||
this.messageService.sendRequestEngineResultError(x);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -22,11 +22,15 @@ export class MessageService {
|
|||
}
|
||||
public sendRequestEngineResultError(result: IRequestEngineResult, action: string = "Ok") {
|
||||
const textKey = 'Requests.ErrorCodes.' + result.errorCode;
|
||||
const text = this.translate.instant(textKey);
|
||||
if (text !== textKey) {
|
||||
this.send(text, action);
|
||||
var text = this.translate.instant(textKey);
|
||||
if (text === textKey) { // Error code on backend may not exist in frontend
|
||||
if (result.errorMessage || result.message) {
|
||||
text = result.errorMessage ? result.errorMessage : result.message;
|
||||
} else {
|
||||
this.send(result.errorMessage ? result.errorMessage : result.message, action);
|
||||
text = this.translate.instant('ErrorPages.SomethingWentWrong');
|
||||
}
|
||||
}
|
||||
|
||||
this.send(text, action);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,8 @@
|
|||
"CheckPageForUpdates": "Check this page for continuous site updates."
|
||||
},
|
||||
"ErrorPages": {
|
||||
"NotFound": "Page not found"
|
||||
"NotFound": "Page not found",
|
||||
"SomethingWentWrong": "Something went wrong!"
|
||||
},
|
||||
"NavigationBar": {
|
||||
"Discover": "Discover",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue