Localize Movie+TV information panel

pull/4359/head
Florian Dupret 3 years ago
parent 87018e8cf5
commit 05b7ce6c7e

@ -2,6 +2,7 @@ import { Component, OnInit, Input } from "@angular/core";
import { IDiscoverCardResult } from "../../interfaces"; import { IDiscoverCardResult } from "../../interfaces";
import { RequestType } from "../../../interfaces"; import { RequestType } from "../../../interfaces";
import { MessageService, RequestService, SearchV2Service } from "../../../services"; import { MessageService, RequestService, SearchV2Service } from "../../../services";
import { TranslateService } from "@ngx-translate/core";
import { MatDialog } from "@angular/material/dialog"; import { MatDialog } from "@angular/material/dialog";
import { ISearchTvResultV2 } from "../../../interfaces/ISearchTvResultV2"; import { ISearchTvResultV2 } from "../../../interfaces/ISearchTvResultV2";
import { ISearchMovieResultV2 } from "../../../interfaces/ISearchMovieResultV2"; import { ISearchMovieResultV2 } from "../../../interfaces/ISearchMovieResultV2";
@ -30,7 +31,7 @@ export class DiscoverCardComponent implements OnInit {
private tvSearchResult: ISearchTvResultV2; private tvSearchResult: ISearchTvResultV2;
constructor(private searchService: SearchV2Service, private dialog: MatDialog, private requestService: RequestService, constructor(private searchService: SearchV2Service, private dialog: MatDialog, private requestService: RequestService,
public messageService: MessageService) { } public messageService: MessageService, private translate: TranslateService) { }
public ngOnInit() { public ngOnInit() {
if (this.result.type == RequestType.tvShow) { if (this.result.type == RequestType.tvShow) {
@ -98,13 +99,13 @@ export class DiscoverCardComponent implements OnInit {
public getAvailbilityStatus(): string { public getAvailbilityStatus(): string {
if (this.result.available) { if (this.result.available) {
return "Available"; return this.translate.instant("Common.Available");
} }
if (this.result.approved) { if (this.result.approved) {
return "Approved"; return this.translate.instant("Common.Approved");
} }
if (this.result.requested) { if (this.result.requested) {
return "Pending"; return this.translate.instant("Common.Pending");
} }
return ""; return "";
} }

@ -17,7 +17,7 @@
</div> </div>
<div *ngIf="streams?.length > 0" class="streaming-on"> <div *ngIf="streams?.length > 0" class="streaming-on">
<hr> <hr>
<span class="label">{{'MediaDetails.StreamingOn' | translate }}:</span> <span class="label">{{'MediaDetails.StreamingOn' | translate }}</span>
<div> <div>
<span *ngFor="let stream of streams"> <span *ngFor="let stream of streams">
<img class="stream-small" [matTooltip]="stream.streamingProvider" src="https://image.tmdb.org/t/p/original{{stream.logo}}"> <img class="stream-small" [matTooltip]="stream.streamingProvider" src="https://image.tmdb.org/t/p/original{{stream.logo}}">
@ -26,11 +26,11 @@
</div> </div>
<hr> <hr>
<div> <div>
<span class="label">{{'MediaDetails.Status' | translate }}:</span> <span class="label">{{'MediaDetails.Status' | translate }}</span>
{{movie.status}} <span id="status">{{ getMovieStatusLabel()}}</span>
</div> </div>
<div> <div>
<span class="label">{{'MediaDetails.Availability' | translate }}:</span> <span class="label">{{'MediaDetails.Availability' | translate }}</span>
<span *ngIf="movie.available"> {{'Common.Available' | translate}}</span> <span *ngIf="movie.available"> {{'Common.Available' | translate}}</span>
<span *ngIf="!movie.available"> {{'Common.NotAvailable' | translate}}</span> <span *ngIf="!movie.available"> {{'Common.NotAvailable' | translate}}</span>
</div> </div>
@ -44,23 +44,23 @@
</div> </div>
<div *ngIf="request"> <div *ngIf="request">
<span class="label">{{'Requests.RequestedBy' | translate }}: </span> <span class="label">{{'MediaDetails.RequestedBy' | translate }}</span>
<span id="requestedByInfo">{{request.requestedUser.userAlias}}</span> <span id="requestedByInfo">{{request.requestedUser.userAlias}}</span>
</div> </div>
<div *ngIf="request"> <div *ngIf="request">
<span class="label">{{'Requests.RequestDate' | translate }}:</span> <span class="label">{{'MediaDetails.RequestDate' | translate }}</span>
{{request.requestedDate | date}} {{request.requestedDate | date}}
</div> </div>
<div *ngIf="request && request.denied"> <div *ngIf="request && request.denied">
<span class="label">{{'Requests.DeniedReason' | translate }}: </span> <span class="label">{{'MediaDetails.DeniedReason' | translate }}</span>
<span id="deniedReasonInfo">{{request.deniedReason}}</span> <span id="deniedReasonInfo">{{request.deniedReason}}</span>
</div> </div>
<div *ngIf="movie.quality"> <div *ngIf="movie.quality">
<span class="label">{{'MediaDetails.Quality' | translate }}:</span> <span class="label">{{'MediaDetails.Quality' | translate }}</span>
<div>{{movie.quality | quality}}</div> <div>{{movie.quality | quality}}</div>
</div> </div>
@ -77,34 +77,34 @@
<hr> <hr>
<span class="label">{{'MediaDetails.TheatricalRelease' | translate }}:</span> <span class="label">{{'MediaDetails.TheatricalRelease' | translate }}</span>
{{movie.releaseDate | date: 'mediumDate'}} {{movie.releaseDate | date: 'mediumDate'}}
<div *ngIf="movie.digitalReleaseDate"> <div *ngIf="movie.digitalReleaseDate">
<span class="label">{{'MediaDetails.DigitalRelease' | translate }}:</span> <span class="label">{{'MediaDetails.DigitalRelease' | translate }}</span>
{{movie.digitalReleaseDate | date: 'mediumDate'}} {{movie.digitalReleaseDate | date: 'mediumDate'}}
</div> </div>
<div *ngIf="movie.voteCount"> <div *ngIf="movie.voteCount">
<span class="label">{{'MediaDetails.Votes' | translate }}:</span> <span class="label">{{'MediaDetails.Votes' | translate }}</span>
{{movie.voteCount | thousandShort: 1}} {{movie.voteCount | thousandShort: 1}}
</div> </div>
<div> <div>
<span class="label">{{'MediaDetails.Runtime' | translate }}:</span> <span class="label">{{'MediaDetails.Runtime' | translate }}</span>
{{'MediaDetails.Minutes' | translate:{runtime: movie.runtime} }} {{'MediaDetails.Minutes' | translate:{runtime: movie.runtime} }}
</div> </div>
<div *ngIf="movie.revenue"> <div *ngIf="movie.revenue">
<span class="label">{{'MediaDetails.Revenue' | translate }}:</span> <span class="label">{{'MediaDetails.Revenue' | translate }}</span>
{{movie.revenue | currency: 'USD'}} {{movie.revenue | currency: 'USD'}}
</div> </div>
<div *ngIf="movie.budget"> <div *ngIf="movie.budget">
<span class="label">{{'MediaDetails.Budget' | translate }}:</span> <span class="label">{{'MediaDetails.Budget' | translate }}</span>
{{movie.budget | currency: 'USD'}} {{movie.budget | currency: 'USD'}}
</div> </div>
<hr /> <hr />
<div class="genre-button-container" *ngIf="movie.genres"> <div class="genre-button-container" *ngIf="movie.genres">
<span class="label">{{'MediaDetails.Genres' | translate }}:</span> <span class="label">{{'MediaDetails.Genres' | translate }}</span>
<div> <div>
<mat-chip-list> <mat-chip-list>
<mat-chip selected *ngFor="let genre of movie.genres"> <mat-chip selected *ngFor="let genre of movie.genres">
@ -116,7 +116,7 @@
<hr /> <hr />
<div class="keyword-button-container" *ngIf="movie?.keywords?.keywordsValue?.length > 0"> <div class="keyword-button-container" *ngIf="movie?.keywords?.keywordsValue?.length > 0">
<span class="label">{{'MediaDetails.Keywords' | translate }}:</span> <span class="label">{{'MediaDetails.Keywords' | translate }}</span>
<mat-chip-list> <mat-chip-list>
<mat-chip selected *ngFor="let keyword of movie.keywords.keywordsValue"> <mat-chip selected *ngFor="let keyword of movie.keywords.keywordsValue">
{{keyword.name}} {{keyword.name}}

@ -1,4 +1,5 @@
import { Component, ViewEncapsulation, Input, OnInit, Inject } from "@angular/core"; import { Component, ViewEncapsulation, Input, OnInit, Inject } from "@angular/core";
import { TranslateService } from "@ngx-translate/core";
import { ISearchMovieResultV2 } from "../../../../interfaces/ISearchMovieResultV2"; import { ISearchMovieResultV2 } from "../../../../interfaces/ISearchMovieResultV2";
import { IMovieRequests } from "../../../../interfaces"; import { IMovieRequests } from "../../../../interfaces";
import { SearchV2Service } from "../../../../services/searchV2.service"; import { SearchV2Service } from "../../../../services/searchV2.service";
@ -13,7 +14,8 @@ import { IStreamingData } from "../../../../interfaces/IStreams";
}) })
export class MovieInformationPanelComponent implements OnInit { export class MovieInformationPanelComponent implements OnInit {
constructor(private searchService: SearchV2Service, @Inject(APP_BASE_HREF) public internalBaseUrl: string) { } constructor(private searchService: SearchV2Service, @Inject(APP_BASE_HREF) public internalBaseUrl: string,
private translate: TranslateService) { }
@Input() public movie: ISearchMovieResultV2; @Input() public movie: ISearchMovieResultV2;
@Input() public request: IMovieRequests; @Input() public request: IMovieRequests;
@ -33,4 +35,14 @@ export class MovieInformationPanelComponent implements OnInit {
this.searchService.getMovieStreams(this.movie.id).subscribe(x => this.streams = x); this.searchService.getMovieStreams(this.movie.id).subscribe(x => this.streams = x);
} }
public getMovieStatusLabel() {
const textKey = 'MediaDetails.StatusValues.' + this.movie.status;
const text = this.translate.instant(textKey);
if (text !== textKey) {
return text;
} else {
return this.movie.status;
}
}
} }

@ -11,7 +11,7 @@
<div *ngIf="streams?.length > 0" id="streamingContainer" class="streaming-on-container"> <div *ngIf="streams?.length > 0" id="streamingContainer" class="streaming-on-container">
<hr> <hr>
<div class="streaming-on-content"> <div class="streaming-on-content">
<span class="label">{{'MediaDetails.StreamingOn' | translate }}:</span> <span class="label">{{'MediaDetails.StreamingOn' | translate }}</span>
<div> <div>
<span *ngFor="let stream of sortBy('order')"> <span *ngFor="let stream of sortBy('order')">
<img class="stream-small" id="stream{{stream.streamingProvider}}" [matTooltip]="stream.streamingProvider" src="https://image.tmdb.org/t/p/original{{stream.logo}}"> <img class="stream-small" id="stream{{stream.streamingProvider}}" [matTooltip]="stream.streamingProvider" src="https://image.tmdb.org/t/p/original{{stream.logo}}">
@ -21,44 +21,44 @@
</div> </div>
<hr> <hr>
<div *ngIf="tv.status"> <div *ngIf="tv.status">
<span class="label">{{'MediaDetails.Status' | translate }}:</span> <span class="label">{{'MediaDetails.Status' | translate }}</span>
<span id="status"> {{tv.status}}</span> <span id="status">{{ getTVStatusLabel()}}</span>
</div> </div>
<span class="label">First Aired:</span> <span class="label">{{'MediaDetails.FirstAired' | translate }}</span>
{{tv.firstAired | date: 'mediumDate'}} {{tv.firstAired | date: 'mediumDate'}}
</div> </div>
<div *ngIf="seasonCount"> <div *ngIf="seasonCount">
<span class="label">Seasons:</span> <span class="label">{{'MediaDetails.Seasons' | translate }}</span>
{{seasonCount}} {{seasonCount}}
</div> </div>
<div *ngIf="totalEpisodes"> <div *ngIf="totalEpisodes">
<span class="label">Episodes:</span> <span class="label">{{'MediaDetails.Episodes' | translate }}</span>
{{totalEpisodes}} {{totalEpisodes}}
</div> </div>
<div *ngIf="advancedOptions && request?.rootPathOverrideTitle"> <div *ngIf="advancedOptions && request?.rootPathOverrideTitle">
<span class="label">{{'MediaDetails.RootFolderOverride' | translate }}:</span> <span class="label">{{'MediaDetails.RootFolderOverride' | translate }}</span>
<div>{{request.rootPathOverrideTitle}}</div> <div>{{request.rootPathOverrideTitle}}</div>
</div> </div>
<div *ngIf="advancedOptions && request?.qualityOverrideTitle"> <div *ngIf="advancedOptions && request?.qualityOverrideTitle">
<span class="label">{{'MediaDetails.QualityOverride' | translate }}:</span> <span class="label">{{'MediaDetails.QualityOverride' | translate }}</span>
<div>{{request.qualityOverrideTitle}}</div> <div>{{request.qualityOverrideTitle}}</div>
</div> </div>
<div> <div>
<span class="label">{{'MediaDetails.Runtime' | translate }}:</span> <span class="label">{{'MediaDetails.Runtime' | translate }}</span>
{{'MediaDetails.Minutes' | translate:{ runtime: tv.runtime} }} {{'MediaDetails.Minutes' | translate:{ runtime: tv.runtime} }}
</div> </div>
<div *ngIf="tv.network"> <div *ngIf="tv.network">
<span class="label">Network:</span> <span class="label">{{'MediaDetails.Network' | translate }}</span>
{{tv.network.name}} {{tv.network.name}}
</div> </div>
<div class="genre-button-container" *ngIf="tv.genres"> <div class="genre-button-container" *ngIf="tv.genres">
<span class="label">{{'MediaDetails.Genres' | translate }}:</span> <span class="label">{{'MediaDetails.Genres' | translate }}</span>
<div> <div>
<mat-chip-list> <mat-chip-list>
<mat-chip selected *ngFor="let genre of tv.genres"> <mat-chip selected *ngFor="let genre of tv.genres">

@ -1,5 +1,6 @@
import { APP_BASE_HREF } from "@angular/common"; import { APP_BASE_HREF } from "@angular/common";
import { Component, ViewEncapsulation, Input, OnInit, Inject } from "@angular/core"; import { Component, ViewEncapsulation, Input, OnInit, Inject } from "@angular/core";
import { TranslateService } from "@ngx-translate/core";
import { ITvRequests } from "../../../../../interfaces"; import { ITvRequests } from "../../../../../interfaces";
import { ITvRatings } from "../../../../../interfaces/IRatings"; import { ITvRatings } from "../../../../../interfaces/IRatings";
import { ISearchTvResultV2 } from "../../../../../interfaces/ISearchTvResultV2"; import { ISearchTvResultV2 } from "../../../../../interfaces/ISearchTvResultV2";
@ -14,7 +15,8 @@ import { SearchV2Service } from "../../../../../services";
}) })
export class TvInformationPanelComponent implements OnInit { export class TvInformationPanelComponent implements OnInit {
constructor(private searchService: SearchV2Service, @Inject(APP_BASE_HREF) public internalBaseUrl: string) { } constructor(private searchService: SearchV2Service, @Inject(APP_BASE_HREF) public internalBaseUrl: string,
private translate: TranslateService) { }
@Input() public tv: ISearchTvResultV2; @Input() public tv: ISearchTvResultV2;
@Input() public request: ITvRequests; @Input() public request: ITvRequests;
@ -43,5 +45,15 @@ export class TvInformationPanelComponent implements OnInit {
public sortBy(prop: string) { public sortBy(prop: string) {
return this.streams.sort((a, b) => a[prop] > b[prop] ? 1 : a[prop] === b[prop] ? 0 : -1); return this.streams.sort((a, b) => a[prop] > b[prop] ? 1 : a[prop] === b[prop] ? 0 : -1);
} }
public getTVStatusLabel() {
const textKey = 'MediaDetails.StatusValues.' + this.tv.status;
const text = this.translate.instant(textKey);
if (text !== textKey) {
return text;
} else {
return this.tv.status;
}
}
} }

@ -14,6 +14,8 @@
"Common": { "Common": {
"ContinueButton": "Continue", "ContinueButton": "Continue",
"Available": "Available", "Available": "Available",
"Approved": "Approved",
"Pending": "Pending",
"PartiallyAvailable": "Partially Available", "PartiallyAvailable": "Partially Available",
"Monitored": "Monitored", "Monitored": "Monitored",
"NotAvailable": "Not Available", "NotAvailable": "Not Available",
@ -269,21 +271,33 @@
"QualityProfilesSelect":"Select A Quality Profile", "QualityProfilesSelect":"Select A Quality Profile",
"RootFolderSelect":"Select A Root Folder", "RootFolderSelect":"Select A Root Folder",
"LanguageProfileSelect":"Select A Language Profile", "LanguageProfileSelect":"Select A Language Profile",
"Status":"Status", "Status":"Status:",
"Availability":"Availability", "StatusValues" : {
"Planned": "Planned",
"In Production": "In Production",
"Released": "Released",
"Returning Series": "Returning Series",
"Ended": "Ended",
"Canceled": "Canceled"
},
"Seasons": "Seasons:",
"Episodes": "Episodes:",
"Availability":"Availability:",
"RequestStatus":"Request Status", "RequestStatus":"Request Status",
"Quality":"Quality", "Quality":"Quality:",
"RootFolderOverride":"Root Folder Override", "RootFolderOverride":"Root Folder Override:",
"QualityOverride":"Quality Override", "QualityOverride":"Quality Override:",
"Genres":"Genres", "Network":"Network:",
"TheatricalRelease":"Release", "Genres":"Genres:",
"DigitalRelease":"Digital Release", "FirstAired":"First Aired:",
"Votes":"Votes", "TheatricalRelease":"Release:",
"Runtime":"Runtime", "DigitalRelease":"Digital Release:",
"Votes":"Votes:",
"Runtime":"Runtime:",
"Minutes": "{{runtime}} Minutes", "Minutes": "{{runtime}} Minutes",
"Revenue":"Revenue", "Revenue":"Revenue:",
"Budget":"Budget", "Budget":"Budget:",
"Keywords":"Keywords/Tags", "Keywords":"Keywords/Tags:",
"Casts": { "Casts": {
"CastTitle": "Cast" "CastTitle": "Cast"
}, },
@ -297,7 +311,10 @@
"RadarrConfiguration": "Radarr Configuration", "RadarrConfiguration": "Radarr Configuration",
"RequestOnBehalf": "Request on behalf of", "RequestOnBehalf": "Request on behalf of",
"PleaseSelectUser": "Please select a user", "PleaseSelectUser": "Please select a user",
"StreamingOn": "Streaming On", "StreamingOn": "Streaming On:",
"RequestedBy": "Requested By:",
"RequestDate": "Request Date:",
"DeniedReason": "Denied Reason:",
"ReProcessRequest": "Re-Process Request" "ReProcessRequest": "Re-Process Request"
}, },
"Discovery": { "Discovery": {

Loading…
Cancel
Save