feat(i18n): translate dashboard scroller titles dynamically (EN/ES)
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
<ng-container *transloco="let t; prefix: 'dashboard.scroller'">
|
<ng-container *transloco="let t; prefix: 'dashboard.scroller'">
|
||||||
<div class="dashboard-scroller-container">
|
<div class="dashboard-scroller-container">
|
||||||
<h2 class="dashboard-scroller-title">
|
<h2 class="dashboard-scroller-title">
|
||||||
{{ title }}
|
{{ title | transloco }}
|
||||||
@if (isMagicShelf) {
|
@if (isMagicShelf) {
|
||||||
<i class="pi pi-sparkles magic-shelf-icon"></i>
|
<i class="pi pi-sparkles magic-shelf-icon"></i>
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -7,7 +7,7 @@ import {ProgressSpinnerModule} from 'primeng/progressspinner';
|
|||||||
import {Book} from '../../../book/model/book.model';
|
import {Book} from '../../../book/model/book.model';
|
||||||
import {ScrollerType} from '../../models/dashboard-config.model';
|
import {ScrollerType} from '../../models/dashboard-config.model';
|
||||||
import { BookCardOverlayPreferenceService } from '../../../book/components/book-browser/book-card-overlay-preference.service';
|
import { BookCardOverlayPreferenceService } from '../../../book/components/book-browser/book-card-overlay-preference.service';
|
||||||
import {TranslocoDirective} from '@jsverse/transloco';
|
import {TranslocoDirective, TranslocoPipe} from '@jsverse/transloco';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dashboard-scroller',
|
selector: 'app-dashboard-scroller',
|
||||||
@@ -18,7 +18,8 @@ import {TranslocoDirective} from '@jsverse/transloco';
|
|||||||
BookCardComponent,
|
BookCardComponent,
|
||||||
ProgressSpinnerModule,
|
ProgressSpinnerModule,
|
||||||
NgClass,
|
NgClass,
|
||||||
TranslocoDirective
|
TranslocoDirective,
|
||||||
|
TranslocoPipe
|
||||||
],
|
],
|
||||||
standalone: true
|
standalone: true
|
||||||
})
|
})
|
||||||
|
|||||||
+6
-8
@@ -114,23 +114,21 @@ export class DashboardSettingsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getScrollerTitle(scroller: ScrollerConfig): string {
|
getScrollerTitle(scroller: ScrollerConfig): string {
|
||||||
const t = (key: string) => this.translocoService.translate(`dashboard.settings.scrollerTypes.${key}`);
|
|
||||||
|
|
||||||
if (scroller.type === ScrollerType.MAGIC_SHELF && scroller.magicShelfId) {
|
if (scroller.type === ScrollerType.MAGIC_SHELF && scroller.magicShelfId) {
|
||||||
return this.magicShelvesMap.get(scroller.magicShelfId) || t('magicShelf');
|
return this.magicShelvesMap.get(scroller.magicShelfId) || 'dashboard.scroller.magicShelf';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (scroller.type) {
|
switch (scroller.type) {
|
||||||
case ScrollerType.LAST_READ:
|
case ScrollerType.LAST_READ:
|
||||||
return t('lastRead');
|
return 'dashboard.scroller.continueReading';
|
||||||
case ScrollerType.LAST_LISTENED:
|
case ScrollerType.LAST_LISTENED:
|
||||||
return t('lastListened');
|
return 'dashboard.scroller.continueListening';
|
||||||
case ScrollerType.LATEST_ADDED:
|
case ScrollerType.LATEST_ADDED:
|
||||||
return t('latestAdded');
|
return 'dashboard.scroller.recentlyAdded';
|
||||||
case ScrollerType.RANDOM:
|
case ScrollerType.RANDOM:
|
||||||
return t('random');
|
return 'dashboard.scroller.discoverNew';
|
||||||
default:
|
default:
|
||||||
return t('default');
|
return 'dashboard.scroller.default';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ export interface DashboardConfig {
|
|||||||
|
|
||||||
export const DEFAULT_DASHBOARD_CONFIG: DashboardConfig = {
|
export const DEFAULT_DASHBOARD_CONFIG: DashboardConfig = {
|
||||||
scrollers: [
|
scrollers: [
|
||||||
{id: '1', type: ScrollerType.LAST_LISTENED, title: 'Continue Listening', enabled: true, order: 1, maxItems: DEFAULT_MAX_ITEMS},
|
{id: '1', type: ScrollerType.LAST_LISTENED, title: 'dashboard.scroller.continueListening', enabled: true, order: 1, maxItems: DEFAULT_MAX_ITEMS},
|
||||||
{id: '2', type: ScrollerType.LAST_READ, title: 'Continue Reading', enabled: true, order: 2, maxItems: DEFAULT_MAX_ITEMS},
|
{id: '2', type: ScrollerType.LAST_READ, title: 'dashboard.scroller.continueReading', enabled: true, order: 2, maxItems: DEFAULT_MAX_ITEMS},
|
||||||
{id: '3', type: ScrollerType.LATEST_ADDED, title: 'Recently Added', enabled: true, order: 3, maxItems: DEFAULT_MAX_ITEMS},
|
{id: '3', type: ScrollerType.LATEST_ADDED, title: 'dashboard.scroller.recentlyAdded', enabled: true, order: 3, maxItems: DEFAULT_MAX_ITEMS},
|
||||||
{id: '4', type: ScrollerType.RANDOM, title: 'Discover Something New', enabled: true, order: 4, maxItems: DEFAULT_MAX_ITEMS}
|
{id: '4', type: ScrollerType.RANDOM, title: 'dashboard.scroller.discoverNew', enabled: true, order: 4, maxItems: DEFAULT_MAX_ITEMS}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,7 +9,13 @@
|
|||||||
},
|
},
|
||||||
"scroller": {
|
"scroller": {
|
||||||
"noBooksFound": "No books found for this scroller.",
|
"noBooksFound": "No books found for this scroller.",
|
||||||
"loadError": "Failed to load books! Please try refreshing the page."
|
"loadError": "Failed to load books! Please try refreshing the page.",
|
||||||
|
"continueListening": "Continue Listening",
|
||||||
|
"continueReading": "Continue Reading",
|
||||||
|
"recentlyAdded": "Recently Added",
|
||||||
|
"discoverNew": "Discover Something New",
|
||||||
|
"magicShelf": "Magic Shelf",
|
||||||
|
"default": "Scroller"
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"title": "Dashboard Configuration",
|
"title": "Dashboard Configuration",
|
||||||
|
|||||||
@@ -9,7 +9,13 @@
|
|||||||
},
|
},
|
||||||
"scroller": {
|
"scroller": {
|
||||||
"noBooksFound": "No se encontraron libros para este carrusel.",
|
"noBooksFound": "No se encontraron libros para este carrusel.",
|
||||||
"loadError": "Error al cargar los libros. Por favor, intenta actualizar la pagina."
|
"loadError": "Error al cargar los libros. Por favor, intenta actualizar la pagina.",
|
||||||
|
"continueListening": "Seguir escuchando",
|
||||||
|
"continueReading": "Seguir leyendo",
|
||||||
|
"recentlyAdded": "Añadidos recientemente",
|
||||||
|
"discoverNew": "Descubre algo nuevo",
|
||||||
|
"magicShelf": "Estante mágico",
|
||||||
|
"default": "Carrusel"
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"title": "Configuración del panel",
|
"title": "Configuración del panel",
|
||||||
|
|||||||
Reference in New Issue
Block a user