From 005529cda86638050841110d8dec0f44ad31972a Mon Sep 17 00:00:00 2001 From: sephrat <34862846+sephrat@users.noreply.github.com> Date: Fri, 12 Nov 2021 23:11:51 +0100 Subject: [PATCH] =?UTF-8?q?=20fix(translations):=20=F0=9F=8C=90=20Localize?= =?UTF-8?q?=20more=20places=20(#4400)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Localize a few isolated strings * Localize paginator * Localize a few isolated strings * Make button width dynamic for better i18n * Localize a few isolated strings * Fix technical typo --- src/Ombi/ClientApp/src/app/app.module.ts | 7 ++++ .../src/app/errors/not-found.component.ts | 2 +- .../components/details/details.component.html | 2 +- .../src/app/localization/MatPaginatorI18n.ts | 34 +++++++++++++++++++ .../movie/movie-details.component.html | 2 +- .../movie-information-panel.component.html | 2 +- .../tv-information-panel.component.html | 4 +-- .../tv-requests-panel.component.html | 5 +-- .../media-details.component.scss | 3 +- .../app/requests/movierequests.component.html | 2 +- .../music/musicrequests.component.html | 2 +- .../app/requests/tvrequests.component.html | 2 +- .../shared/chat-box/chat-box.component.html | 6 ++-- .../genre-select/genre-select.component.html | 2 +- .../keyword-search.component.html | 2 +- .../watch-providers-select.component.html | 2 +- .../unsubscribe-confirm.component.html | 2 +- src/Ombi/wwwroot/translations/en.json | 25 ++++++++++++-- 18 files changed, 84 insertions(+), 22 deletions(-) create mode 100644 src/Ombi/ClientApp/src/app/localization/MatPaginatorI18n.ts diff --git a/src/Ombi/ClientApp/src/app/app.module.ts b/src/Ombi/ClientApp/src/app/app.module.ts index b4e78087c..082ce80d2 100644 --- a/src/Ombi/ClientApp/src/app/app.module.ts +++ b/src/Ombi/ClientApp/src/app/app.module.ts @@ -65,6 +65,9 @@ import { TooltipModule } from "primeng/tooltip"; import { TranslateHttpLoader } from "@ngx-translate/http-loader"; import { UnauthorizedInterceptor } from "./auth/unauthorized.interceptor"; import { environment } from "../environments/environment"; +import { MatPaginatorIntl } from "@angular/material/paginator"; +import { TranslateService } from "@ngx-translate/core"; +import { MatPaginatorI18n } from "./localization/MatPaginatorI18n"; const routes: Routes = [ { path: "*", component: PageNotFoundComponent }, @@ -212,6 +215,10 @@ export function JwtTokenGetter() { useClass: UnauthorizedInterceptor, multi: true }, + { + provide: MatPaginatorIntl, deps: [TranslateService], + useFactory: (translateService: TranslateService) => new MatPaginatorI18n(translateService).getPaginatorIntl() + }, ], bootstrap: [AppComponent], }) diff --git a/src/Ombi/ClientApp/src/app/errors/not-found.component.ts b/src/Ombi/ClientApp/src/app/errors/not-found.component.ts index f102d0449..25269ecd1 100644 --- a/src/Ombi/ClientApp/src/app/errors/not-found.component.ts +++ b/src/Ombi/ClientApp/src/app/errors/not-found.component.ts @@ -1,6 +1,6 @@ import { Component } from "@angular/core"; @Component({ - template: "

Page not found

", + template: "

{{ 'ErrorPages.NotFound' | translate }}

", }) export class PageNotFoundComponent { } diff --git a/src/Ombi/ClientApp/src/app/issues/components/details/details.component.html b/src/Ombi/ClientApp/src/app/issues/components/details/details.component.html index bc0e8a794..42a84171b 100644 --- a/src/Ombi/ClientApp/src/app/issues/components/details/details.component.html +++ b/src/Ombi/ClientApp/src/app/issues/components/details/details.component.html @@ -1,6 +1,6 @@
-

Issues for {{details.title}}

+

{{ 'Issues.IssuesForTitle' | translate: { title: details.title} }}

{{'Issues.Requested' | translate}} diff --git a/src/Ombi/ClientApp/src/app/localization/MatPaginatorI18n.ts b/src/Ombi/ClientApp/src/app/localization/MatPaginatorI18n.ts new file mode 100644 index 000000000..71a86b7bd --- /dev/null +++ b/src/Ombi/ClientApp/src/app/localization/MatPaginatorI18n.ts @@ -0,0 +1,34 @@ +import { MatPaginatorIntl } from '@angular/material/paginator'; +import { TranslateService } from '@ngx-translate/core'; + +export class MatPaginatorI18n { + + constructor(private translate: TranslateService) { } + + getPaginatorIntl(): MatPaginatorIntl { + const paginatorIntl = new MatPaginatorIntl(); + paginatorIntl.itemsPerPageLabel = this.translate.instant('Paginator.itemsPerPageLabel'); + paginatorIntl.nextPageLabel = this.translate.instant('Paginator.nextPageLabel'); + paginatorIntl.previousPageLabel = this.translate.instant('Paginator.previousPageLabel'); + paginatorIntl.firstPageLabel = this.translate.instant('Paginator.firstPageLabel'); + paginatorIntl.lastPageLabel = this.translate.instant('Paginator.lastPageLabel'); + paginatorIntl.getRangeLabel = this.getRangeLabel.bind(this); + return paginatorIntl; + } + + private getRangeLabel(page: number, pageSize: number, length: number): string { + if (length == 0 || pageSize == 0) { + return this.translate.instant('Paginator.rangePageLabel1', { length }); + } + + length = Math.max(length, 0); + + const startIndex = page * pageSize; + + // If the start index exceeds the list length, do not try and fix the end index to the end. + const endIndex = + startIndex < length ? Math.min(startIndex + pageSize, length) : startIndex + pageSize; + + return this.translate.instant('Paginator.rangePageLabel2', { startIndex: startIndex + 1, endIndex, length }); + } +} \ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html b/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html index 4e088bd69..3cfe6383a 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/movie/movie-details.component.html @@ -143,7 +143,7 @@
- Trailers + {{'MediaDetails.Trailers' | translate}} diff --git a/src/Ombi/ClientApp/src/app/media-details/components/movie/panels/movie-information-panel.component.html b/src/Ombi/ClientApp/src/app/media-details/components/movie/panels/movie-information-panel.component.html index 1aafc30bf..1fa528159 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/movie/panels/movie-information-panel.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/movie/panels/movie-information-panel.component.html @@ -104,7 +104,7 @@
- {{'MediaDetails.Genres' | translate }} + {{'MediaDetails.GenresLabel' | translate }}
diff --git a/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-information-panel/tv-information-panel.component.html b/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-information-panel/tv-information-panel.component.html index 9d1d927bd..e0d6a793b 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-information-panel/tv-information-panel.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-information-panel/tv-information-panel.component.html @@ -58,7 +58,7 @@
- {{'MediaDetails.Genres' | translate }} + {{'MediaDetails.GenresLabel' | translate }}
@@ -70,7 +70,7 @@
- {{'MediaDetails.Keywords' | translate }}: + {{'MediaDetails.Keywords' | translate }} {{keyword.name}} diff --git a/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-requests/tv-requests-panel.component.html b/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-requests/tv-requests-panel.component.html index 663226aa5..7f29ff2b2 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-requests/tv-requests-panel.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-requests/tv-requests-panel.component.html @@ -5,8 +5,9 @@
{{ request.requestStatus | translate }}
- {{'Requests.RequestedBy' | translate}} '{{request.requestedUser.userAlias}}' on - {{request.requestedDate | amLocal | amUserLocale | amDateFormat: 'LL' }} + {{'Requests.RequestedByOn' | translate: { + user: request.requestedUser.userAlias, + date: request.requestedDate | amLocal | amUserLocale | amDateFormat: 'LL' } }} - {{request.deniedReason}} diff --git a/src/Ombi/ClientApp/src/app/media-details/media-details.component.scss b/src/Ombi/ClientApp/src/app/media-details/media-details.component.scss index 3b9fd4a15..119035062 100644 --- a/src/Ombi/ClientApp/src/app/media-details/media-details.component.scss +++ b/src/Ombi/ClientApp/src/app/media-details/media-details.component.scss @@ -323,8 +323,7 @@ } .media-row .mat-raised-button{ - padding:2px 1.5em;; - width:170px; + padding:2px 1.5em; margin-top:10px; margin-left:10px; } diff --git a/src/Ombi/ClientApp/src/app/requests/movierequests.component.html b/src/Ombi/ClientApp/src/app/requests/movierequests.component.html index 03c932fd8..4e7ad3628 100644 --- a/src/Ombi/ClientApp/src/app/requests/movierequests.component.html +++ b/src/Ombi/ClientApp/src/app/requests/movierequests.component.html @@ -1,6 +1,6 @@
- + +
\ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/shared/components/genre-select/genre-select.component.html b/src/Ombi/ClientApp/src/app/shared/components/genre-select/genre-select.component.html index 4e5bf394a..b28f7de02 100644 --- a/src/Ombi/ClientApp/src/app/shared/components/genre-select/genre-select.component.html +++ b/src/Ombi/ClientApp/src/app/shared/components/genre-select/genre-select.component.html @@ -10,7 +10,7 @@ cancel
cancel cancel -

Unsubscribed!

+

{{ 'UserPreferences.Unsubscribed' | translate }}

\ No newline at end of file diff --git a/src/Ombi/wwwroot/translations/en.json b/src/Ombi/wwwroot/translations/en.json index 8c3107d77..1ed23fd47 100644 --- a/src/Ombi/wwwroot/translations/en.json +++ b/src/Ombi/wwwroot/translations/en.json @@ -55,6 +55,9 @@ "OfflineParagraph": "The media server is currently offline.", "CheckPageForUpdates": "Check this page for continuous site updates." }, + "ErrorPages": { + "NotFound": "Page not found" + }, "NavigationBar": { "Discover": "Discover", "Search": "Search", @@ -131,6 +134,9 @@ }, "AdvancedSearchInstructions": "Please choose what type of media you are searching for:", "YearOfRelease": "Year of Release", + "SearchGenre": "Search Genre", + "SearchKeyword": "Search Keyword", + "SearchProvider": "Search Provider", "KeywordSearchingDisclaimer": "Please note that Keyword Searching is very hit and miss due to the inconsistent data in TheMovieDb" }, "Requests": { @@ -224,6 +230,7 @@ }, "Issues": { "Title": "Issues", + "IssuesForTitle": "Issues for {{title}}", "PendingTitle": "Pending Issues", "InProgressTitle": "In Progress Issues", "ResolvedTitle": "Resolved Issues", @@ -256,6 +263,7 @@ "Delete": "Delete issue", "DeletedIssue": "Issue has been deleted", "Chat":"Chat", + "EnterYourMessage":"Enter Your Message", "Requested":"Requested", "UserOnDate": "{{user}} on {{date}}" }, @@ -282,6 +290,7 @@ }, "MediaDetails": { "Denied": "Denied", + "Trailers": "Trailers", "RecommendationsTitle": "Recommendations", "SimilarTitle": "Similar", "VideosTitle": "Videos", @@ -318,7 +327,8 @@ "RootFolderOverride":"Root Folder Override:", "QualityOverride":"Quality Override:", "Network":"Network:", - "Genres":"Genres:", + "GenresLabel":"Genres:", + "Genres":"Genres", "FirstAired":"First Aired:", "TheatricalRelease":"Release:", "DigitalRelease":"Digital Release:", @@ -344,6 +354,7 @@ "PleaseSelectUser": "Please select a user", "StreamingOn": "Streaming On:", "RequestedBy": "Requested By:", + "RequestedByOn": "Requested By {{user}} on {{date}}", "RequestDate": "Request Date:", "DeniedReason": "Denied Reason:", "ReProcessRequest": "Re-Process Request", @@ -397,7 +408,8 @@ "NewPasswordConfirm": "New Password Confirm", "Security": "Security", "Profile": "Profile", - "UpdatedYourInformation": "Updated your information" + "UpdatedYourInformation": "Updated your information", + "Unsubscribed": "Unsubscribed!" }, "UserTypeLabel": { "1": "Local User", @@ -405,6 +417,15 @@ "3": "Emby User", "4": "Emby Connect User", "5": "Jellyfin User" + }, + "Paginator": { + "itemsPerPageLabel": "Items per page:", + "nextPageLabel": "Next page", + "previousPageLabel": "Previous page", + "firstPageLabel": "First page", + "lastPageLabel": "Last page", + "rangePageLabel1": "0 of {{length}}", + "rangePageLabel2": "{{startIndex}} – {{endIndex}} of {{length}}" } }