From 9fa7b0736c13b0637ac8789cbd428f5fe99acb34 Mon Sep 17 00:00:00 2001 From: ACX <8075870+acx10@users.noreply.github.com> Date: Sat, 14 Feb 2026 00:18:26 -0700 Subject: [PATCH] feat: add i18n translations for stats, pdf reader, magic shelf, and remaining components (en/es) (#2742) --- .../book-browser/book-browser.component.ts | 3 +- .../book-filter/book-filter.component.html | 2 +- .../book-filter/book-filter.component.ts | 16 +- .../book-filter/book-filter.config.ts | 65 +++ .../book-table/book-table.component.ts | 46 +- .../book-browser/sorting/BookSorter.ts | 101 ++-- .../series-page/series-page.component.ts | 8 +- .../book/service/book-menu.service.ts | 2 +- .../component/magic-shelf-component.html | 82 +-- .../component/magic-shelf-component.ts | 157 +++--- .../metadata-editor.component.html | 4 +- .../pdf-reader/pdf-reader.component.html | 4 +- .../pdf-reader/pdf-reader.component.ts | 6 +- .../custom-fonts/custom-fonts.component.ts | 2 +- .../settings/user-management/user.service.ts | 10 + .../user-profile-dialog.component.ts | 2 +- .../filter-preferences.component.ts | 10 +- .../author-universe-chart.component.html | 12 +- .../author-universe-chart.component.ts | 59 ++- .../book-formats-chart.component.html | 8 +- .../book-formats-chart.component.ts | 6 +- .../language-chart.component.html | 8 +- .../language-chart.component.ts | 6 +- .../metadata-score-chart.component.html | 8 +- .../metadata-score-chart.component.ts | 34 +- .../page-count-chart.component.html | 8 +- .../page-count-chart.component.ts | 14 +- .../publication-timeline-chart.component.html | 30 +- .../publication-timeline-chart.component.ts | 11 +- .../publication-trend-chart.component.html | 38 +- .../publication-trend-chart.component.ts | 15 +- .../reading-journey-chart.component.html | 38 +- .../reading-journey-chart.component.ts | 18 +- .../top-items-chart.component.html | 12 +- .../top-items-chart.component.ts | 99 ++-- .../library-stats.component.html | 50 +- .../library-stats/library-stats.component.ts | 41 +- .../service/library-filter.service.ts | 10 +- .../book-length-chart.component.html | 14 +- .../book-length-chart.component.ts | 68 ++- .../completion-race-chart.component.html | 28 +- .../completion-race-chart.component.ts | 10 +- .../completion-timeline-chart.component.html | 11 +- .../completion-timeline-chart.component.ts | 19 +- .../favorite-days-chart.component.html | 12 +- .../favorite-days-chart.component.ts | 43 +- .../genre-stats-chart.component.html | 8 +- .../genre-stats-chart.component.ts | 27 +- .../page-turner-chart.component.html | 20 +- .../page-turner-chart.component.ts | 28 +- .../peak-hours-chart.component.html | 12 +- .../peak-hours-chart.component.ts | 45 +- .../personal-rating-chart.component.html | 9 +- .../personal-rating-chart.component.ts | 17 +- .../rating-taste-chart.component.html | 28 +- .../rating-taste-chart.component.ts | 66 +-- .../read-status-chart.component.html | 8 +- .../read-status-chart.component.ts | 70 +-- .../reading-clock-chart.component.html | 18 +- .../reading-clock-chart.component.ts | 14 +- .../reading-dna-chart.component.html | 10 +- .../reading-dna-chart.component.ts | 118 ++--- .../reading-habits-chart.component.html | 10 +- .../reading-habits-chart.component.ts | 117 +---- .../reading-heatmap-chart.component.html | 9 +- .../reading-heatmap-chart.component.ts | 11 +- .../reading-progress-chart.component.html | 8 +- .../reading-progress-chart.component.ts | 18 +- .../reading-session-heatmap.component.html | 20 +- .../reading-session-heatmap.component.ts | 18 +- .../reading-session-timeline.component.html | 18 +- .../reading-session-timeline.component.ts | 16 +- .../reading-survival-chart.component.html | 20 +- .../reading-survival-chart.component.ts | 14 +- .../series-progress-chart.component.html | 50 +- .../series-progress-chart.component.ts | 26 +- .../service/user-chart-config.service.ts | 43 +- .../user-stats/user-stats.component.html | 16 +- .../user-stats/user-stats.component.ts | 4 +- .../metadata-progress-widget-component.html | 22 +- .../metadata-progress-widget-component.ts | 16 +- .../layout-topbar/app.topbar.component.html | 2 +- booklore-ui/src/i18n/en/book.json | 124 ++++- booklore-ui/src/i18n/en/common.json | 7 +- booklore-ui/src/i18n/en/index.ts | 6 +- booklore-ui/src/i18n/en/layout.json | 1 + booklore-ui/src/i18n/en/magic-shelf.json | 122 +++++ booklore-ui/src/i18n/en/metadata.json | 1 + booklore-ui/src/i18n/en/reader-pdf.json | 10 + booklore-ui/src/i18n/en/shared.json | 16 +- booklore-ui/src/i18n/en/stats-library.json | 220 ++++++++ booklore-ui/src/i18n/en/stats-user.json | 474 ++++++++++++++++++ booklore-ui/src/i18n/es/book.json | 124 ++++- booklore-ui/src/i18n/es/common.json | 7 +- booklore-ui/src/i18n/es/index.ts | 6 +- booklore-ui/src/i18n/es/layout.json | 1 + booklore-ui/src/i18n/es/magic-shelf.json | 122 +++++ booklore-ui/src/i18n/es/metadata.json | 1 + booklore-ui/src/i18n/es/reader-pdf.json | 10 + booklore-ui/src/i18n/es/shared.json | 16 +- booklore-ui/src/i18n/es/stats-library.json | 220 ++++++++ booklore-ui/src/i18n/es/stats-user.json | 474 ++++++++++++++++++ 102 files changed, 3177 insertions(+), 991 deletions(-) create mode 100644 booklore-ui/src/i18n/en/magic-shelf.json create mode 100644 booklore-ui/src/i18n/en/reader-pdf.json create mode 100644 booklore-ui/src/i18n/en/stats-library.json create mode 100644 booklore-ui/src/i18n/en/stats-user.json create mode 100644 booklore-ui/src/i18n/es/magic-shelf.json create mode 100644 booklore-ui/src/i18n/es/reader-pdf.json create mode 100644 booklore-ui/src/i18n/es/stats-library.json create mode 100644 booklore-ui/src/i18n/es/stats-user.json diff --git a/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.ts b/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.ts index 29c8a10e5..356cb829e 100644 --- a/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.ts +++ b/booklore-ui/src/app/features/book/components/book-browser/book-browser.component.ts @@ -166,7 +166,8 @@ export class BookBrowserComponent implements OnInit, AfterViewInit, OnDestroy { private sideBarFilter = new SideBarFilter(this.selectedFilter, this.selectedFilterMode); private headerFilter = new HeaderFilter(this.searchTerm$); protected bookSorter = new BookSorter( - sortCriteria => this.onMultiSortChange(sortCriteria) + sortCriteria => this.onMultiSortChange(sortCriteria), + this.t ); private sortService = inject(SortService); diff --git a/booklore-ui/src/app/features/book/components/book-browser/book-filter/book-filter.component.html b/booklore-ui/src/app/features/book/components/book-browser/book-filter/book-filter.component.html index aca44975d..3ce30f106 100644 --- a/booklore-ui/src/app/features/book/components/book-browser/book-filter/book-filter.component.html +++ b/booklore-ui/src/app/features/book/components/book-browser/book-filter/book-filter.component.html @@ -22,7 +22,7 @@ - {{ filterLabels[filterType] || (filterType | titlecase) }} + {{ getFilterLabel(filterType) }} @if (activeFilters[filterType]?.length) { diff --git a/booklore-ui/src/app/features/book/components/book-browser/book-filter/book-filter.component.ts b/booklore-ui/src/app/features/book/components/book-browser/book-filter/book-filter.component.ts index 6b20b518c..13c8f2b4c 100644 --- a/booklore-ui/src/app/features/book/components/book-browser/book-filter/book-filter.component.ts +++ b/booklore-ui/src/app/features/book/components/book-browser/book-filter/book-filter.component.ts @@ -5,16 +5,16 @@ import {Shelf} from '../../../model/shelf.model'; import {EntityType} from '../book-browser.component'; import {Accordion, AccordionContent, AccordionHeader, AccordionPanel} from 'primeng/accordion'; import {CdkFixedSizeVirtualScroll, CdkVirtualForOf, CdkVirtualScrollViewport} from '@angular/cdk/scrolling'; -import {AsyncPipe, NgClass, TitleCasePipe} from '@angular/common'; +import {AsyncPipe, NgClass} from '@angular/common'; import {Badge} from 'primeng/badge'; import {FormsModule} from '@angular/forms'; import {SelectButton} from 'primeng/selectbutton'; import {BookFilterMode, DEFAULT_VISIBLE_FILTERS, UserService, VisibleFilterType} from '../../../../settings/user-management/user.service'; import {MagicShelf} from '../../../../magic-shelf/service/magic-shelf.service'; -import {Filter, FILTER_LABELS, FilterType} from './book-filter.config'; +import {Filter, FILTER_LABEL_KEYS, FilterType} from './book-filter.config'; import {BookFilterService} from './book-filter.service'; import {filter} from 'rxjs/operators'; -import {TranslocoDirective} from '@jsverse/transloco'; +import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; type FilterModeOption = { label: string; value: BookFilterMode }; @@ -27,7 +27,7 @@ type FilterModeOption = { label: string; value: BookFilterMode }; imports: [ Accordion, AccordionPanel, AccordionHeader, AccordionContent, CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf, - NgClass, Badge, AsyncPipe, TitleCasePipe, FormsModule, SelectButton, + NgClass, Badge, AsyncPipe, FormsModule, SelectButton, TranslocoDirective ] }) @@ -42,6 +42,7 @@ export class BookFilterComponent implements OnInit, OnDestroy { private readonly filterService = inject(BookFilterService); private readonly userService = inject(UserService); + private readonly t = inject(TranslocoService); private readonly destroy$ = new Subject(); private readonly activeFilters$ = new BehaviorSubject | null>(null); @@ -57,7 +58,12 @@ export class BookFilterComponent implements OnInit, OnDestroy { private _selectedFilterMode: BookFilterMode = 'and'; private _visibleFilters: VisibleFilterType[] = [...DEFAULT_VISIBLE_FILTERS]; - readonly filterLabels = FILTER_LABELS; + readonly filterLabelKeys = FILTER_LABEL_KEYS; + + getFilterLabel(type: FilterType): string { + const key = this.filterLabelKeys[type]; + return key ? this.t.translate(key) : type; + } readonly filterModeOptions: FilterModeOption[] = [ {label: 'AND', value: 'and'}, {label: 'OR', value: 'or'}, diff --git a/booklore-ui/src/app/features/book/components/book-browser/book-filter/book-filter.config.ts b/booklore-ui/src/app/features/book/components/book-browser/book-filter/book-filter.config.ts index 8c6e50d20..fb374fdd5 100644 --- a/booklore-ui/src/app/features/book/components/book-browser/book-filter/book-filter.config.ts +++ b/booklore-ui/src/app/features/book/components/book-browser/book-filter/book-filter.config.ts @@ -269,6 +269,71 @@ export const FILTER_EXTRACTORS: Readonly, } }; +// Translation key for each FilterType — used by UI components to translate filter labels +export const FILTER_LABEL_KEYS: Readonly> = { + author: 'book.filter.labels.author', + category: 'book.filter.labels.category', + series: 'book.filter.labels.series', + bookType: 'book.filter.labels.bookType', + readStatus: 'book.filter.labels.readStatus', + personalRating: 'book.filter.labels.personalRating', + publisher: 'book.filter.labels.publisher', + matchScore: 'book.filter.labels.matchScore', + library: 'book.filter.labels.library', + shelf: 'book.filter.labels.shelf', + shelfStatus: 'book.filter.labels.shelfStatus', + tag: 'book.filter.labels.tag', + publishedDate: 'book.filter.labels.publishedDate', + fileSize: 'book.filter.labels.fileSize', + amazonRating: 'book.filter.labels.amazonRating', + goodreadsRating: 'book.filter.labels.goodreadsRating', + hardcoverRating: 'book.filter.labels.hardcoverRating', + language: 'book.filter.labels.language', + pageCount: 'book.filter.labels.pageCount', + mood: 'book.filter.labels.mood', + ageRating: 'book.filter.labels.ageRating', + contentRating: 'book.filter.labels.contentRating', + narrator: 'book.filter.labels.narrator', + comicCharacter: 'book.filter.labels.comicCharacter', + comicTeam: 'book.filter.labels.comicTeam', + comicLocation: 'book.filter.labels.comicLocation', + comicCreator: 'book.filter.labels.comicCreator' +}; + +export const READ_STATUS_LABEL_KEYS: Readonly> = { + [ReadStatus.UNREAD]: 'book.filter.readStatus.unread', + [ReadStatus.READING]: 'book.filter.readStatus.reading', + [ReadStatus.RE_READING]: 'book.filter.readStatus.reReading', + [ReadStatus.PARTIALLY_READ]: 'book.filter.readStatus.partiallyRead', + [ReadStatus.PAUSED]: 'book.filter.readStatus.paused', + [ReadStatus.READ]: 'book.filter.readStatus.read', + [ReadStatus.WONT_READ]: 'book.filter.readStatus.wontRead', + [ReadStatus.ABANDONED]: 'book.filter.readStatus.abandoned', + [ReadStatus.UNSET]: 'book.filter.readStatus.unset' +}; + +export const CONTENT_RATING_LABEL_KEYS: Readonly> = { + 'EVERYONE': 'book.filter.contentRating.everyone', + 'TEEN': 'book.filter.contentRating.teen', + 'MATURE': 'book.filter.contentRating.mature', + 'ADULT': 'book.filter.contentRating.adult', + 'EXPLICIT': 'book.filter.contentRating.explicit' +}; + +export const SHELF_STATUS_LABEL_KEYS: Readonly> = { + 'shelved': 'book.filter.shelfStatus.shelved', + 'unshelved': 'book.filter.shelfStatus.unshelved' +}; + +export const COMIC_ROLE_LABEL_KEYS: Readonly> = { + penciller: 'book.filter.comicRoles.penciller', + inker: 'book.filter.comicRoles.inker', + colorist: 'book.filter.comicRoles.colorist', + letterer: 'book.filter.comicRoles.letterer', + coverArtist: 'book.filter.comicRoles.coverArtist', + editor: 'book.filter.comicRoles.editor' +}; + export const FILTER_CONFIGS: Readonly, Omit>> = { author: {label: 'Author', sortMode: 'count'}, category: {label: 'Genre', sortMode: 'count'}, diff --git a/booklore-ui/src/app/features/book/components/book-browser/book-table/book-table.component.ts b/booklore-ui/src/app/features/book/components/book-browser/book-table/book-table.component.ts index f65eaf682..8193ca1a1 100644 --- a/booklore-ui/src/app/features/book/components/book-browser/book-table/book-table.component.ts +++ b/booklore-ui/src/app/features/book/components/book-browser/book-table/book-table.component.ts @@ -55,29 +55,29 @@ export class BookTableComponent implements OnInit, OnDestroy, OnChanges { private metadataCenterViewMode: 'route' | 'dialog' = 'route'; private destroy$ = new Subject(); - readonly allColumns = [ - {field: 'readStatus', header: '📖'}, - {field: 'title', header: 'Title'}, - {field: 'authors', header: 'Authors'}, - {field: 'publisher', header: 'Publisher'}, - {field: 'seriesName', header: 'Series'}, - {field: 'seriesNumber', header: 'Series #'}, - {field: 'categories', header: 'Genres'}, - {field: 'publishedDate', header: 'Published'}, - {field: 'lastReadTime', header: 'Last Read'}, - {field: 'addedOn', header: 'Added'}, - {field: 'fileName', header: 'File Name'}, - {field: 'fileSizeKb', header: 'File Size'}, - {field: 'language', header: 'Language'}, - {field: 'isbn', header: 'ISBN'}, - {field: 'pageCount', header: 'Pages'}, - {field: 'amazonRating', header: 'Amazon'}, - {field: 'amazonReviewCount', header: 'AZ #'}, - {field: 'goodreadsRating', header: 'Goodreads'}, - {field: 'goodreadsReviewCount', header: 'GR #'}, - {field: 'hardcoverRating', header: 'Hardcover'}, - {field: 'hardcoverReviewCount', header: 'HC #'}, - {field: 'ranobedbRating', header: 'Ranobedb'}, + readonly allColumns: { field: string; header: string }[] = [ + {field: 'readStatus', header: this.t.translate('book.columnPref.columns.readStatus')}, + {field: 'title', header: this.t.translate('book.columnPref.columns.title')}, + {field: 'authors', header: this.t.translate('book.columnPref.columns.authors')}, + {field: 'publisher', header: this.t.translate('book.columnPref.columns.publisher')}, + {field: 'seriesName', header: this.t.translate('book.columnPref.columns.seriesName')}, + {field: 'seriesNumber', header: this.t.translate('book.columnPref.columns.seriesNumber')}, + {field: 'categories', header: this.t.translate('book.columnPref.columns.categories')}, + {field: 'publishedDate', header: this.t.translate('book.columnPref.columns.publishedDate')}, + {field: 'lastReadTime', header: this.t.translate('book.columnPref.columns.lastReadTime')}, + {field: 'addedOn', header: this.t.translate('book.columnPref.columns.addedOn')}, + {field: 'fileName', header: this.t.translate('book.columnPref.columns.fileName')}, + {field: 'fileSizeKb', header: this.t.translate('book.columnPref.columns.fileSizeKb')}, + {field: 'language', header: this.t.translate('book.columnPref.columns.language')}, + {field: 'isbn', header: this.t.translate('book.columnPref.columns.isbn')}, + {field: 'pageCount', header: this.t.translate('book.columnPref.columns.pageCount')}, + {field: 'amazonRating', header: this.t.translate('book.columnPref.columns.amazonRating')}, + {field: 'amazonReviewCount', header: this.t.translate('book.columnPref.columns.amazonReviewCount')}, + {field: 'goodreadsRating', header: this.t.translate('book.columnPref.columns.goodreadsRating')}, + {field: 'goodreadsReviewCount', header: this.t.translate('book.columnPref.columns.goodreadsReviewCount')}, + {field: 'hardcoverRating', header: this.t.translate('book.columnPref.columns.hardcoverRating')}, + {field: 'hardcoverReviewCount', header: this.t.translate('book.columnPref.columns.hardcoverReviewCount')}, + {field: 'ranobedbRating', header: this.t.translate('book.columnPref.columns.ranobedbRating')}, ]; scrollHeight = 'calc(100dvh - 160px)'; diff --git a/booklore-ui/src/app/features/book/components/book-browser/sorting/BookSorter.ts b/booklore-ui/src/app/features/book/components/book-browser/sorting/BookSorter.ts index 9c16e56d8..9ead1937a 100644 --- a/booklore-ui/src/app/features/book/components/book-browser/sorting/BookSorter.ts +++ b/booklore-ui/src/app/features/book/components/book-browser/sorting/BookSorter.ts @@ -1,41 +1,80 @@ import {SortDirection, SortOption} from '../../../model/sort.model'; import {CdkDragDrop, moveItemInArray} from '@angular/cdk/drag-drop'; +import {TranslocoService} from '@jsverse/transloco'; + +export const SORT_OPTION_LABEL_KEYS: Readonly> = { + title: 'book.sorting.options.title', + fileName: 'book.sorting.options.fileName', + filePath: 'book.sorting.options.filePath', + author: 'book.sorting.options.author', + authorSurnameVorname: 'book.sorting.options.authorSurnameVorname', + seriesName: 'book.sorting.options.seriesName', + seriesNumber: 'book.sorting.options.seriesNumber', + lastReadTime: 'book.sorting.options.lastReadTime', + personalRating: 'book.sorting.options.personalRating', + addedOn: 'book.sorting.options.addedOn', + fileSizeKb: 'book.sorting.options.fileSizeKb', + locked: 'book.sorting.options.locked', + publisher: 'book.sorting.options.publisher', + publishedDate: 'book.sorting.options.publishedDate', + readStatus: 'book.sorting.options.readStatus', + dateFinished: 'book.sorting.options.dateFinished', + readingProgress: 'book.sorting.options.readingProgress', + bookType: 'book.sorting.options.bookType', + amazonRating: 'book.sorting.options.amazonRating', + amazonReviewCount: 'book.sorting.options.amazonReviewCount', + goodreadsRating: 'book.sorting.options.goodreadsRating', + goodreadsReviewCount: 'book.sorting.options.goodreadsReviewCount', + hardcoverRating: 'book.sorting.options.hardcoverRating', + hardcoverReviewCount: 'book.sorting.options.hardcoverReviewCount', + ranobedbRating: 'book.sorting.options.ranobedbRating', + narrator: 'book.sorting.options.narrator', + pageCount: 'book.sorting.options.pageCount', + random: 'book.sorting.options.random' +}; + +const SORT_FIELDS: { field: string; defaultLabel: string }[] = [ + {field: 'title', defaultLabel: 'Title'}, + {field: 'fileName', defaultLabel: 'File Name'}, + {field: 'filePath', defaultLabel: 'File Path'}, + {field: 'author', defaultLabel: 'Author'}, + {field: 'authorSurnameVorname', defaultLabel: 'Author (Surname)'}, + {field: 'seriesName', defaultLabel: 'Series Name'}, + {field: 'seriesNumber', defaultLabel: 'Series Number'}, + {field: 'lastReadTime', defaultLabel: 'Last Read'}, + {field: 'personalRating', defaultLabel: 'Personal Rating'}, + {field: 'addedOn', defaultLabel: 'Added On'}, + {field: 'fileSizeKb', defaultLabel: 'File Size'}, + {field: 'locked', defaultLabel: 'Locked'}, + {field: 'publisher', defaultLabel: 'Publisher'}, + {field: 'publishedDate', defaultLabel: 'Published Date'}, + {field: 'readStatus', defaultLabel: 'Read Status'}, + {field: 'dateFinished', defaultLabel: 'Date Finished'}, + {field: 'readingProgress', defaultLabel: 'Reading Progress'}, + {field: 'bookType', defaultLabel: 'Book Type'}, + {field: 'amazonRating', defaultLabel: 'Amazon Rating'}, + {field: 'amazonReviewCount', defaultLabel: 'Amazon #'}, + {field: 'goodreadsRating', defaultLabel: 'Goodreads Rating'}, + {field: 'goodreadsReviewCount', defaultLabel: 'Goodreads #'}, + {field: 'hardcoverRating', defaultLabel: 'Hardcover Rating'}, + {field: 'hardcoverReviewCount', defaultLabel: 'Hardcover #'}, + {field: 'ranobedbRating', defaultLabel: 'Ranobedb Rating'}, + {field: 'narrator', defaultLabel: 'Narrator'}, + {field: 'pageCount', defaultLabel: 'Pages'}, + {field: 'random', defaultLabel: 'Random'}, +]; export class BookSorter { selectedSortCriteria: SortOption[] = []; - sortOptions: SortOption[] = [ - {label: 'Title', field: 'title', direction: SortDirection.ASCENDING}, - {label: 'File Name', field: 'fileName', direction: SortDirection.ASCENDING}, - {label: 'File Path', field: 'filePath', direction: SortDirection.ASCENDING}, - {label: 'Author', field: 'author', direction: SortDirection.ASCENDING}, - {label: 'Author (Surname)', field: 'authorSurnameVorname', direction: SortDirection.ASCENDING}, - {label: 'Series Name', field: 'seriesName', direction: SortDirection.ASCENDING}, - {label: 'Series Number', field: 'seriesNumber', direction: SortDirection.ASCENDING}, - {label: 'Last Read', field: 'lastReadTime', direction: SortDirection.ASCENDING}, - {label: 'Personal Rating', field: 'personalRating', direction: SortDirection.ASCENDING}, - {label: 'Added On', field: 'addedOn', direction: SortDirection.ASCENDING}, - {label: 'File Size', field: 'fileSizeKb', direction: SortDirection.ASCENDING}, - {label: 'Locked', field: 'locked', direction: SortDirection.ASCENDING}, - {label: 'Publisher', field: 'publisher', direction: SortDirection.ASCENDING}, - {label: 'Published Date', field: 'publishedDate', direction: SortDirection.ASCENDING}, - {label: 'Read Status', field: 'readStatus', direction: SortDirection.ASCENDING}, - {label: 'Date Finished', field: 'dateFinished', direction: SortDirection.ASCENDING}, - {label: 'Reading Progress', field: 'readingProgress', direction: SortDirection.ASCENDING}, - {label: 'Book Type', field: 'bookType', direction: SortDirection.ASCENDING}, - {label: 'Amazon Rating', field: 'amazonRating', direction: SortDirection.ASCENDING}, - {label: 'Amazon #', field: 'amazonReviewCount', direction: SortDirection.ASCENDING}, - {label: 'Goodreads Rating', field: 'goodreadsRating', direction: SortDirection.ASCENDING}, - {label: 'Goodreads #', field: 'goodreadsReviewCount', direction: SortDirection.ASCENDING}, - {label: 'Hardcover Rating', field: 'hardcoverRating', direction: SortDirection.ASCENDING}, - {label: 'Hardcover #', field: 'hardcoverReviewCount', direction: SortDirection.ASCENDING}, - {label: 'Ranobedb Rating', field: 'ranobedbRating', direction: SortDirection.ASCENDING}, - {label: 'Narrator', field: 'narrator', direction: SortDirection.ASCENDING}, - {label: 'Pages', field: 'pageCount', direction: SortDirection.ASCENDING}, - {label: 'Random', field: 'random', direction: SortDirection.ASCENDING}, - ]; + sortOptions: SortOption[]; - constructor(private onSortChange: (criteria: SortOption[]) => void) { + constructor(private onSortChange: (criteria: SortOption[]) => void, translocoService?: TranslocoService) { + this.sortOptions = SORT_FIELDS.map(({field, defaultLabel}) => { + const key = SORT_OPTION_LABEL_KEYS[field]; + const label = key && translocoService ? translocoService.translate(key) : defaultLabel; + return {label, field, direction: SortDirection.ASCENDING}; + }); } // For backward compatibility - get first sort option diff --git a/booklore-ui/src/app/features/book/components/series-page/series-page.component.ts b/booklore-ui/src/app/features/book/components/series-page/series-page.component.ts index cf8670ca2..26eff80e5 100644 --- a/booklore-ui/src/app/features/book/components/series-page/series-page.component.ts +++ b/booklore-ui/src/app/features/book/components/series-page/series-page.component.ts @@ -443,8 +443,8 @@ export class SeriesPageComponent implements OnDestroy { message: this.t.translate('book.browser.confirm.regenCoverMessage', {count}), header: this.t.translate('book.browser.confirm.regenCoverHeader'), icon: 'pi pi-image', - acceptLabel: 'Yes', - rejectLabel: 'No', + acceptLabel: this.t.translate('common.yes'), + rejectLabel: this.t.translate('common.no'), acceptButtonProps: { label: this.t.translate('common.yes'), severity: 'success' @@ -483,8 +483,8 @@ export class SeriesPageComponent implements OnDestroy { message: this.t.translate('book.browser.confirm.customCoverMessage', {count}), header: this.t.translate('book.browser.confirm.customCoverHeader'), icon: 'pi pi-palette', - acceptLabel: 'Yes', - rejectLabel: 'No', + acceptLabel: this.t.translate('common.yes'), + rejectLabel: this.t.translate('common.no'), acceptButtonProps: { label: this.t.translate('common.yes'), severity: 'success' diff --git a/booklore-ui/src/app/features/book/service/book-menu.service.ts b/booklore-ui/src/app/features/book/service/book-menu.service.ts index 7d75ea059..6b8eb3ce7 100644 --- a/booklore-ui/src/app/features/book/service/book-menu.service.ts +++ b/booklore-ui/src/app/features/book/service/book-menu.service.ts @@ -334,7 +334,7 @@ export class BookMenuService { if (allShelfIds.size === 0) { this.loadingService.hide(loader); - this.messageService.add({ severity: 'info', summary: 'Info', detail: this.t.translate('book.menuService.toast.noBooksOnShelvesDetail') }); + this.messageService.add({ severity: 'info', summary: this.t.translate('common.info'), detail: this.t.translate('book.menuService.toast.noBooksOnShelvesDetail') }); return; } diff --git a/booklore-ui/src/app/features/magic-shelf/component/magic-shelf-component.html b/booklore-ui/src/app/features/magic-shelf/component/magic-shelf-component.html index a2655c925..e411b046b 100644 --- a/booklore-ui/src/app/features/magic-shelf/component/magic-shelf-component.html +++ b/booklore-ui/src/app/features/magic-shelf/component/magic-shelf-component.html @@ -1,3 +1,4 @@ +
@@ -5,9 +6,9 @@

- {{ editMode ? 'Edit Magic Shelf' : 'Magic Shelf Builder' }} + {{ editMode ? t('header.titleEdit') : t('header.titleCreate') }}

-

Create smart shelves with custom rules to automatically organize your books

+

{{ t('header.description') }}

- - + +
- + @if (selectedIcon) {
@@ -38,7 +39,7 @@ iconClass="selected-icon" alt="Selected shelf icon"> - Click to change + {{ t('form.clickToChange') }}
@@ -55,7 +56,7 @@
- Select Icon + {{ t('form.selectIcon') }}
} @@ -65,7 +66,7 @@
- +
} @@ -80,13 +81,13 @@