diff --git a/booklore-ui/package-lock.json b/booklore-ui/package-lock.json index 4093e208f..5c8cfc2c7 100644 --- a/booklore-ui/package-lock.json +++ b/booklore-ui/package-lock.json @@ -19,6 +19,7 @@ "@angular/router": "^21.1.2", "@angular/service-worker": "^21.1.2", "@iharbeck/ngx-virtual-scroller": "^19.0.1", + "@jsverse/transloco": "^8.2.1", "@primeng/themes": "^21.0.3", "@stomp/rx-stomp": "^2.3.0", "@stomp/stompjs": "^7.2.1", @@ -917,7 +918,6 @@ "version": "7.28.6", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.28.6.tgz", "integrity": "sha512-JYgintcMjRiCvS8mMECzaEn+m3PfoQiyqukOMCCVQtoJGYJw8j/8LBJEiqkHLkfwCcs74E3pbAUFNg7d9VNJ+Q==", - "dev": true, "license": "MIT", "dependencies": { "@babel/helper-validator-identifier": "^7.28.5", @@ -1112,7 +1112,6 @@ "version": "7.28.5", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", - "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -2581,6 +2580,40 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@jsverse/transloco": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@jsverse/transloco/-/transloco-8.2.1.tgz", + "integrity": "sha512-uuapT1vNi/P9wqklO2VY/sIj8HPVQJ1h+IJFhPbiQvk1FP/vgn2LLwGz/iIcet2bAMJVKKxO8FXytdrwRXXyvg==", + "license": "MIT", + "dependencies": { + "@jsverse/transloco-utils": "^8.2.1", + "@jsverse/utils": "1.0.0-beta.5", + "tslib": "^2.2.0" + }, + "peerDependencies": { + "@angular/core": ">=16.0.0", + "rxjs": ">=6.0.0" + } + }, + "node_modules/@jsverse/transloco-utils": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@jsverse/transloco-utils/-/transloco-utils-8.2.1.tgz", + "integrity": "sha512-sAKJQuGgAYRYwndM8X1xVbwOrjENBxKxOwhXE7gFnS8fWUEwBGMswp3wbAOS5jZlLDhyaReesU16ToXLegBCjg==", + "license": "MIT", + "dependencies": { + "cosmiconfig": "^8.1.3", + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@jsverse/utils": { + "version": "1.0.0-beta.5", + "resolved": "https://registry.npmjs.org/@jsverse/utils/-/utils-1.0.0-beta.5.tgz", + "integrity": "sha512-z7IdlV6BdSeF3Veii8Yyk64KuyTjNIQnFaW5PAhmDx0wN29lB2BFp8WO6+tJPLPjtlz2yKeNrjkp1XqnMPaeHA==", + "license": "MIT" + }, "node_modules/@kurkle/color": { "version": "0.3.4", "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.4.tgz", @@ -5263,7 +5296,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true, "license": "Python-2.0" }, "node_modules/aria-query": { @@ -5536,7 +5568,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -5892,6 +5923,32 @@ "url": "https://opencollective.com/express" } }, + "node_modules/cosmiconfig": { + "version": "8.3.6", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz", + "integrity": "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==", + "license": "MIT", + "dependencies": { + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0", + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -6237,6 +6294,15 @@ "dev": true, "license": "MIT" }, + "node_modules/error-ex": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz", + "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==", + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, "node_modules/es-define-property": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", @@ -7173,17 +7239,6 @@ "node": ">= 0.4" } }, - "node_modules/hono": { - "version": "4.11.5", - "resolved": "https://registry.npmjs.org/hono/-/hono-4.11.5.tgz", - "integrity": "sha512-WemPi9/WfyMwZs+ZUXdiwcCh9Y+m7L+8vki9MzDw3jJ+W9Lc+12HGsd368Qc1vZi1xwW8BWMMsnK5efYKPdt4g==", - "dev": true, - "license": "MIT", - "peer": true, - "engines": { - "node": ">=16.9.0" - } - }, "node_modules/hosted-git-info": { "version": "9.0.2", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-9.0.2.tgz", @@ -7383,7 +7438,6 @@ "version": "3.3.1", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", - "dev": true, "license": "MIT", "dependencies": { "parent-module": "^1.0.0", @@ -7443,6 +7497,12 @@ "node": ">= 0.10" } }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "license": "MIT" + }, "node_modules/is-core-module": { "version": "2.16.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", @@ -7625,14 +7685,12 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true, "license": "MIT" }, "node_modules/js-yaml": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", - "dev": true, "license": "MIT", "dependencies": { "argparse": "^2.0.1" @@ -7795,6 +7853,12 @@ "node": ">= 0.8.0" } }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "license": "MIT" + }, "node_modules/listr2": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/listr2/-/listr2-9.0.5.tgz", @@ -8995,7 +9059,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, "license": "MIT", "dependencies": { "callsites": "^3.0.0" @@ -9004,6 +9067,30 @@ "node": ">=6" } }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parse-json/node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "license": "MIT" + }, "node_modules/parse5": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.0.tgz", @@ -9151,6 +9238,15 @@ "url": "https://opencollective.com/express" } }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/pathe": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", @@ -9162,7 +9258,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true, "license": "ISC" }, "node_modules/picomatch": { @@ -9471,7 +9566,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, "license": "MIT", "engines": { "node": ">=4" diff --git a/booklore-ui/package.json b/booklore-ui/package.json index b2a30182f..8025d21a9 100644 --- a/booklore-ui/package.json +++ b/booklore-ui/package.json @@ -23,6 +23,7 @@ "@angular/router": "^21.1.2", "@angular/service-worker": "^21.1.2", "@iharbeck/ngx-virtual-scroller": "^19.0.1", + "@jsverse/transloco": "^8.2.1", "@primeng/themes": "^21.0.3", "@stomp/rx-stomp": "^2.3.0", "@stomp/stompjs": "^7.2.1", diff --git a/booklore-ui/src/app/app.component.html b/booklore-ui/src/app/app.component.html index c787ad532..0a4287723 100644 --- a/booklore-ui/src/app/app.component.html +++ b/booklore-ui/src/app/app.component.html @@ -1,3 +1,4 @@ + @if (loading) {
@@ -6,12 +7,12 @@ @if (offline) { -

You're Offline

-

BookLore needs a connection to the server to load.

-

Check your network and try again.

+

{{ t('offline') }}

+

{{ t('offlineLoadingDescription') }}

+

{{ t('offlineDescription') }}

} @else { -

Loading Booklore…

-

Please wait while we get things ready.

+

{{ t('loading') }}

+

{{ t('loadingDescription') }}

}
@@ -23,9 +24,9 @@ -

You're Offline

-

Your connection was lost. Some features may not work.

- +

{{ t('offline') }}

+

{{ t('connectionLost') }}

+
} @else { @@ -33,3 +34,4 @@ } +
diff --git a/booklore-ui/src/app/app.component.ts b/booklore-ui/src/app/app.component.ts index b0bb0f75e..248470626 100644 --- a/booklore-ui/src/app/app.component.ts +++ b/booklore-ui/src/app/app.component.ts @@ -6,6 +6,7 @@ import {parseLogNotification} from './shared/websocket/model/log-notification.mo import {ConfirmDialog} from 'primeng/confirmdialog'; import {Toast} from 'primeng/toast'; import {RouterOutlet} from '@angular/router'; +import {TranslocoDirective, TranslocoPipe} from '@jsverse/transloco'; import {AuthInitializationService} from './core/security/auth-initialization-service'; import {AppConfigService} from './shared/service/app-config.service'; import {MetadataBatchProgressNotification} from './shared/model/metadata-batch-progress.model'; @@ -22,7 +23,7 @@ import {scan, withLatestFrom} from 'rxjs/operators'; templateUrl: './app.component.html', styleUrl: './app.component.scss', standalone: true, - imports: [ConfirmDialog, Toast, RouterOutlet] + imports: [ConfirmDialog, Toast, RouterOutlet, TranslocoDirective, TranslocoPipe] }) export class AppComponent implements OnInit, OnDestroy { diff --git a/booklore-ui/src/app/core/config/language-initializer.ts b/booklore-ui/src/app/core/config/language-initializer.ts new file mode 100644 index 000000000..1a0260dca --- /dev/null +++ b/booklore-ui/src/app/core/config/language-initializer.ts @@ -0,0 +1,34 @@ +import {inject} from '@angular/core'; +import {TranslocoService} from '@jsverse/transloco'; +import {firstValueFrom} from 'rxjs'; +import {AVAILABLE_LANGS} from './transloco-loader'; + +export const LANG_STORAGE_KEY = 'booklore-lang'; + +function detectLanguage(available: string[]): string { + const saved = localStorage.getItem(LANG_STORAGE_KEY); + if (saved && available.includes(saved)) { + return saved; + } + + const browserLocale = navigator.language; + if (browserLocale && available.includes(browserLocale)) { + return browserLocale; + } + + const baseLang = browserLocale?.split('-')[0]; + if (baseLang && available.includes(baseLang)) { + return baseLang; + } + + return 'en'; +} + +export function initializeLanguage() { + return () => { + const translocoService = inject(TranslocoService); + const lang = detectLanguage(AVAILABLE_LANGS); + translocoService.setActiveLang(lang); + return firstValueFrom(translocoService.load(lang)); + }; +} diff --git a/booklore-ui/src/app/core/config/transloco-loader.ts b/booklore-ui/src/app/core/config/transloco-loader.ts new file mode 100644 index 000000000..32a443013 --- /dev/null +++ b/booklore-ui/src/app/core/config/transloco-loader.ts @@ -0,0 +1,59 @@ +import {Injectable} from '@angular/core'; +import {Translation, TranslocoLoader} from '@jsverse/transloco'; +import {from, of, Observable} from 'rxjs'; +import en from '../../../i18n/en'; + +export const EN_TRANSLATIONS: Translation = en; + +// To add a new language: create src/i18n// with domain JSONs + index.ts, then add an entry here. +const LAZY_LANG_LOADERS: Record Promise<{default: Translation}>> = { + es: () => import('../../../i18n/es'), + it: () => import('../../../i18n/it'), + de: () => import('../../../i18n/de'), + fr: () => import('../../../i18n/fr'), + nl: () => import('../../../i18n/nl'), + pl: () => import('../../../i18n/pl'), + pt: () => import('../../../i18n/pt'), + ru: () => import('../../../i18n/ru'), +}; + +export const AVAILABLE_LANGS = ['en', ...Object.keys(LAZY_LANG_LOADERS)]; + +export const LANG_LABELS: Record = { + en: 'English', + es: 'Español', + it: 'Italiano', + de: 'Deutsch', + fr: 'Français', + nl: 'Nederlands', + pl: 'Polski', + pt: 'Português', + ru: 'Русский', +}; + +function deepMerge(base: Record, override: Record): Record { + const result = {...base}; + for (const key of Object.keys(override)) { + if (override[key] && typeof override[key] === 'object' && !Array.isArray(override[key]) + && base[key] && typeof base[key] === 'object' && !Array.isArray(base[key])) { + result[key] = deepMerge(base[key], override[key]); + } else { + result[key] = override[key]; + } + } + return result; +} + +@Injectable({providedIn: 'root'}) +export class TranslocoInlineLoader implements TranslocoLoader { + getTranslation(lang: string): Observable { + if (lang === 'en') { + return of(EN_TRANSLATIONS); + } + const loader = LAZY_LANG_LOADERS[lang]; + if (loader) { + return from(loader().then(m => deepMerge(EN_TRANSLATIONS, m.default))); + } + return of(EN_TRANSLATIONS); + } +} diff --git a/booklore-ui/src/app/core/security/oauth2-management/authentication-settings.component.html b/booklore-ui/src/app/core/security/oauth2-management/authentication-settings.component.html index 4ed91736d..14046cd64 100644 --- a/booklore-ui/src/app/core/security/oauth2-management/authentication-settings.component.html +++ b/booklore-ui/src/app/core/security/oauth2-management/authentication-settings.component.html @@ -1,12 +1,12 @@ +

- Authentication Settings + {{ t('title') }}

- Configure authentication methods for your Booklore instance. Internal authentication is always enabled, - and you can optionally enable OIDC for external authentication providers. + {{ t('description') }}

@@ -14,10 +14,10 @@

- Authentication Methods + {{ t('methods.sectionTitle') }}

- Choose which authentication methods are available for users to sign in. + {{ t('methods.sectionDesc') }}

@@ -30,12 +30,12 @@
- Internal Authentication - Always Enabled + {{ t('internal.label') }} + {{ t('internal.status') }}

- Built-in username and password authentication. This is the default method and cannot be disabled. + {{ t('internal.description') }}

- OIDC Authentication - Experimental + {{ t('oidc.label') }} + {{ t('oidc.experimental') }} - {{ oidcEnabled ? 'Enabled' : 'Disabled' }} + {{ oidcEnabled ? t('oidc.enabled') : t('oidc.disabled') }}

- OpenID Connect for single sign-on with external providers (Authentik, Keycloak, etc.). + {{ t('oidc.description') }} @if (!isOidcFormComplete() && !oidcEnabled) { - Configure settings below to enable. + {{ t('oidc.configHint') }} }

@@ -85,15 +85,15 @@

- OIDC Provider Configuration + {{ t('providerConfig.sectionTitle') }}

- Configure your OIDC provider settings. All fields are required to enable OIDC authentication. + {{ t('providerConfig.sectionDesc') }}

- + + [placeholder]="t('providerConfig.providerPlaceholder')"/>
- + + [placeholder]="t('providerConfig.clientIdPlaceholder')"/>
- + + [placeholder]="t('providerConfig.issuerPlaceholder')"/>
- + - Required scopes for OIDC login. Must be supported by your provider. + {{ t('providerConfig.scopeHint') }}
-

Claim Mappings

+

{{ t('providerConfig.claimMappings') }}

- Map OIDC token claims to Booklore user fields. These must match your provider's token claims. + {{ t('providerConfig.claimDesc') }}

- + + [placeholder]="t('providerConfig.usernamePlaceholder')"/>
- + + [placeholder]="t('providerConfig.emailPlaceholder')"/>
- + + [placeholder]="t('providerConfig.namePlaceholder')"/>
@@ -186,15 +186,15 @@

- User Provisioning + {{ t('provisioning.sectionTitle') }}

- Configure how new OIDC users are created and what permissions they receive. + {{ t('provisioning.sectionDesc') }}

- Automatic User Provisioning + {{ t('provisioning.autoLabel') }} - {{ autoUserProvisioningEnabled ? 'Enabled' : 'Disabled' }} + {{ autoUserProvisioningEnabled ? t('provisioning.autoEnabled') : t('provisioning.autoDisabled') }}

- When enabled, new users are automatically created on first OIDC login with the permissions below. - When disabled, users must be manually created in Booklore before they can log in via OIDC. + {{ t('provisioning.autoDesc') }}

-

Default Permissions

+

{{ t('provisioning.defaultPerms') }}

- +
@for (perm of availablePermissions; track perm) {
@@ -245,20 +244,20 @@ [binary]="true" [inputId]="perm.value"> - +
}
-

Default Library Access

+

{{ t('provisioning.defaultLibraryAccess') }}

@@ -269,3 +268,4 @@
} +
diff --git a/booklore-ui/src/app/core/security/oauth2-management/authentication-settings.component.ts b/booklore-ui/src/app/core/security/oauth2-management/authentication-settings.component.ts index a99cc17ee..3fee83a6f 100644 --- a/booklore-ui/src/app/core/security/oauth2-management/authentication-settings.component.ts +++ b/booklore-ui/src/app/core/security/oauth2-management/authentication-settings.component.ts @@ -14,6 +14,7 @@ import {MultiSelect} from 'primeng/multiselect'; import {Library} from '../../../features/book/model/library.model'; import {LibraryService} from '../../../features/book/service/library.service'; import {ExternalDocLinkComponent} from '../../../shared/components/external-doc-link/external-doc-link.component'; +import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco'; @Component({ selector: 'app-authentication-settings', @@ -27,21 +28,23 @@ import {ExternalDocLinkComponent} from '../../../shared/components/external-doc- Button, MultiSelect, ReactiveFormsModule, - ExternalDocLinkComponent + ExternalDocLinkComponent, + TranslocoDirective, + TranslocoPipe ], styleUrls: ['./authentication-settings.component.scss'] }) export class AuthenticationSettingsComponent implements OnInit { availablePermissions = [ - {label: 'Upload Books', value: 'permissionUpload', selected: false}, - {label: 'Download Books', value: 'permissionDownload', selected: false}, - {label: 'Edit Book Metadata', value: 'permissionEditMetadata', selected: false}, - {label: 'Manage Library', value: 'permissionManipulateLibrary', selected: false}, - {label: 'Email Book', value: 'permissionEmailBook', selected: false}, - {label: 'Delete Book', value: 'permissionDeleteBook', selected: false}, - {label: 'KOReader Sync', value: 'permissionSyncKoreader', selected: false}, - {label: 'Kobo Sync', value: 'permissionSyncKobo', selected: false}, - {label: 'Access OPDS', value: 'permissionAccessOpds', selected: false} + {label: 'Upload Books', value: 'permissionUpload', selected: false, translationKey: 'perms.uploadBooks'}, + {label: 'Download Books', value: 'permissionDownload', selected: false, translationKey: 'perms.downloadBooks'}, + {label: 'Edit Book Metadata', value: 'permissionEditMetadata', selected: false, translationKey: 'perms.editMetadata'}, + {label: 'Manage Library', value: 'permissionManipulateLibrary', selected: false, translationKey: 'perms.manageLibrary'}, + {label: 'Email Book', value: 'permissionEmailBook', selected: false, translationKey: 'perms.emailBook'}, + {label: 'Delete Book', value: 'permissionDeleteBook', selected: false, translationKey: 'perms.deleteBook'}, + {label: 'KOReader Sync', value: 'permissionSyncKoreader', selected: false, translationKey: 'perms.koreaderSync'}, + {label: 'Kobo Sync', value: 'permissionSyncKobo', selected: false, translationKey: 'perms.koboSync'}, + {label: 'Access OPDS', value: 'permissionAccessOpds', selected: false, translationKey: 'perms.accessOpds'} ]; internalAuthEnabled = true; @@ -65,6 +68,7 @@ export class AuthenticationSettingsComponent implements OnInit { private appSettingsService = inject(AppSettingsService); private messageService = inject(MessageService); private libraryService = inject(LibraryService); + private t = inject(TranslocoService); appSettings$: Observable = this.appSettingsService.appSettings$; @@ -118,13 +122,13 @@ export class AuthenticationSettingsComponent implements OnInit { this.appSettingsService.toggleOidcEnabled(this.oidcEnabled).subscribe({ next: () => this.messageService.add({ severity: 'success', - summary: 'Saved', - detail: 'OIDC setting updated.' + summary: this.t.translate('settingsAuth.toast.saved'), + detail: this.t.translate('settingsAuth.toast.oidcUpdated') }), error: () => this.messageService.add({ severity: 'error', - summary: 'Error', - detail: 'Failed to update OIDC setting.' + summary: this.t.translate('common.error'), + detail: this.t.translate('settingsAuth.toast.oidcError') }) }); } @@ -139,13 +143,13 @@ export class AuthenticationSettingsComponent implements OnInit { this.appSettingsService.saveSettings(payload).subscribe({ next: () => this.messageService.add({ severity: 'success', - summary: 'Saved', - detail: 'OIDC provider settings saved.' + summary: this.t.translate('settingsAuth.toast.saved'), + detail: this.t.translate('settingsAuth.toast.providerSaved') }), error: () => this.messageService.add({ severity: 'error', - summary: 'Error', - detail: 'Failed to save OIDC provider settings.' + summary: this.t.translate('common.error'), + detail: this.t.translate('settingsAuth.toast.providerError') }) }); } @@ -170,13 +174,13 @@ export class AuthenticationSettingsComponent implements OnInit { this.appSettingsService.saveSettings(payload).subscribe({ next: () => this.messageService.add({ severity: 'success', - summary: 'Saved', - detail: 'OIDC auto-provisioning settings saved.' + summary: this.t.translate('settingsAuth.toast.saved'), + detail: this.t.translate('settingsAuth.toast.provisionSaved') }), error: () => this.messageService.add({ severity: 'error', - summary: 'Error', - detail: 'Failed to save OIDC auto-provisioning settings.' + summary: this.t.translate('common.error'), + detail: this.t.translate('settingsAuth.toast.provisionError') }) }); } diff --git a/booklore-ui/src/app/core/testing/transloco-testing.ts b/booklore-ui/src/app/core/testing/transloco-testing.ts new file mode 100644 index 000000000..5db4bb5e0 --- /dev/null +++ b/booklore-ui/src/app/core/testing/transloco-testing.ts @@ -0,0 +1,14 @@ +import {TranslocoTestingModule, TranslocoTestingOptions} from '@jsverse/transloco'; +import {EN_TRANSLATIONS} from '../config/transloco-loader'; + +export function getTranslocoModule(options: TranslocoTestingOptions = {}) { + return TranslocoTestingModule.forRoot({ + langs: {en: EN_TRANSLATIONS, ...options.langs}, + translocoConfig: { + availableLangs: ['en'], + defaultLang: 'en', + ...options.translocoConfig, + }, + ...options, + }); +} diff --git a/booklore-ui/src/app/features/bookdrop/component/bookdrop-bulk-edit-dialog/bookdrop-bulk-edit-dialog.component.html b/booklore-ui/src/app/features/bookdrop/component/bookdrop-bulk-edit-dialog/bookdrop-bulk-edit-dialog.component.html index a5aa545b2..c3397d457 100644 --- a/booklore-ui/src/app/features/bookdrop/component/bookdrop-bulk-edit-dialog/bookdrop-bulk-edit-dialog.component.html +++ b/booklore-ui/src/app/features/bookdrop/component/bookdrop-bulk-edit-dialog/bookdrop-bulk-edit-dialog.component.html @@ -1,13 +1,14 @@ +
- Select which fields to apply to {{ fileCount }} selected file(s). Only checked fields will be updated. +
-

Text Fields

+

{{ t('textFieldsTitle') }}

@for (field of textFields; track field.name) {
@@ -15,7 +16,7 @@ [binary]="true" [ngModel]="isFieldEnabled(field.name)" (ngModelChange)="toggleField(field.name)" - [ariaLabel]="'Enable ' + field.label"> + [ariaLabel]="t('enableField', { label: field.label })">
-

Number Fields

+

{{ t('numberFieldsTitle') }}

@for (field of numberFields; track field.name) {
@@ -40,7 +41,7 @@ [binary]="true" [ngModel]="isFieldEnabled(field.name)" (ngModelChange)="toggleField(field.name)" - [ariaLabel]="'Enable ' + field.label"> + [ariaLabel]="t('enableField', { label: field.label })">
-

Array Fields

+

{{ t('arrayFieldsTitle') }}

- Mode: + {{ t('modeLabel') }}
-

Type and press Enter to add each item.

+

{{ t('helperText') }}

@for (field of chipFields; track field.name) {
@@ -79,7 +80,7 @@ [binary]="true" [ngModel]="isFieldEnabled(field.name)" (ngModelChange)="toggleField(field.name)" - [ariaLabel]="'Enable ' + field.label"> + [ariaLabel]="t('enableField', { label: field.label })">
+ diff --git a/booklore-ui/src/app/features/bookdrop/component/bookdrop-bulk-edit-dialog/bookdrop-bulk-edit-dialog.component.ts b/booklore-ui/src/app/features/bookdrop/component/bookdrop-bulk-edit-dialog/bookdrop-bulk-edit-dialog.component.ts index cda287707..c4d09cd5b 100644 --- a/booklore-ui/src/app/features/bookdrop/component/bookdrop-bulk-edit-dialog/bookdrop-bulk-edit-dialog.component.ts +++ b/booklore-ui/src/app/features/bookdrop/component/bookdrop-bulk-edit-dialog/bookdrop-bulk-edit-dialog.component.ts @@ -8,6 +8,7 @@ import {AutoComplete} from 'primeng/autocomplete'; import {Divider} from 'primeng/divider'; import {SelectButton} from 'primeng/selectbutton'; import {BookMetadata} from '../../../book/model/book.model'; +import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco'; export interface BulkEditResult { fields: Partial; @@ -34,6 +35,8 @@ interface BulkEditField { AutoComplete, Divider, SelectButton, + TranslocoDirective, + TranslocoPipe, ], templateUrl: './bookdrop-bulk-edit-dialog.component.html', styleUrl: './bookdrop-bulk-edit-dialog.component.scss' @@ -43,6 +46,7 @@ export class BookdropBulkEditDialogComponent implements OnInit { private readonly dialogRef = inject(DynamicDialogRef); private readonly config = inject(DynamicDialogConfig); private readonly cdr = inject(ChangeDetectorRef); + private readonly t = inject(TranslocoService); fileCount: number = 0; mergeArrays = true; @@ -61,25 +65,25 @@ export class BookdropBulkEditDialogComponent implements OnInit { }); textFields: BulkEditField[] = [ - {name: 'seriesName', label: 'Series Name', type: 'text', controlName: 'seriesName'}, - {name: 'publisher', label: 'Publisher', type: 'text', controlName: 'publisher'}, - {name: 'language', label: 'Language', type: 'text', controlName: 'language'}, + {name: 'seriesName', label: this.t.translate('bookdrop.bulkEdit.seriesName'), type: 'text', controlName: 'seriesName'}, + {name: 'publisher', label: this.t.translate('bookdrop.bulkEdit.publisher'), type: 'text', controlName: 'publisher'}, + {name: 'language', label: this.t.translate('bookdrop.bulkEdit.language'), type: 'text', controlName: 'language'}, ]; numberFields: BulkEditField[] = [ - {name: 'seriesTotal', label: 'Series Total', type: 'number', controlName: 'seriesTotal'}, + {name: 'seriesTotal', label: this.t.translate('bookdrop.bulkEdit.seriesTotal'), type: 'number', controlName: 'seriesTotal'}, ]; chipFields: BulkEditField[] = [ - {name: 'authors', label: 'Authors', type: 'chips', controlName: 'authors'}, - {name: 'categories', label: 'Genres', type: 'chips', controlName: 'categories'}, - {name: 'moods', label: 'Moods', type: 'chips', controlName: 'moods'}, - {name: 'tags', label: 'Tags', type: 'chips', controlName: 'tags'}, + {name: 'authors', label: this.t.translate('bookdrop.bulkEdit.authors'), type: 'chips', controlName: 'authors'}, + {name: 'categories', label: this.t.translate('bookdrop.bulkEdit.genres'), type: 'chips', controlName: 'categories'}, + {name: 'moods', label: this.t.translate('bookdrop.bulkEdit.moods'), type: 'chips', controlName: 'moods'}, + {name: 'tags', label: this.t.translate('bookdrop.bulkEdit.tags'), type: 'chips', controlName: 'tags'}, ]; mergeOptions = [ - {label: 'Merge', value: true}, - {label: 'Replace', value: false}, + {label: this.t.translate('bookdrop.bulkEdit.mergeOption'), value: true}, + {label: this.t.translate('bookdrop.bulkEdit.replaceOption'), value: false}, ]; ngOnInit(): void { @@ -113,7 +117,7 @@ export class BookdropBulkEditDialogComponent implements OnInit { target.value = ''; } } - + if (!this.enabledFields.has(fieldName)) { const control = this.bulkEditForm.get(fieldName); const value = control?.value; diff --git a/booklore-ui/src/app/features/bookdrop/component/bookdrop-file-metadata-picker/bookdrop-file-metadata-picker.component.html b/booklore-ui/src/app/features/bookdrop/component/bookdrop-file-metadata-picker/bookdrop-file-metadata-picker.component.html index 0ae6e72d5..830db668d 100644 --- a/booklore-ui/src/app/features/bookdrop/component/bookdrop-file-metadata-picker/bookdrop-file-metadata-picker.component.html +++ b/booklore-ui/src/app/features/bookdrop/component/bookdrop-file-metadata-picker/bookdrop-file-metadata-picker.component.html @@ -1,17 +1,18 @@ + @if (fetchedMetadata && fetchedMetadata.title) {
-

File Data

+

{{ t('fileData') }}

@@ -20,7 +21,7 @@ icon="pi pi-angle-double-left" class="btn-margin" [outlined]="true" - pTooltip="Overwrite all fields with fetched metadata" + [pTooltip]="t('overwriteAllTooltip')" tooltipPosition="bottom" (onClick)="copyAll()" > @@ -30,12 +31,12 @@ icon="pi pi-refresh" class="btn-margin" [outlined]="true" - pTooltip="Reset all fields to original values" + [pTooltip]="t('resetAllTooltip')" tooltipPosition="bottom" (onClick)="confirmReset()" >
-

Fetched Data

+

{{ t('fetchedData') }}

@@ -57,7 +58,7 @@ > } @else { -
No cover image
+
{{ t('noCoverImage') }}
}
@@ -82,7 +83,7 @@ > } @else { -
Cover image not found
+
{{ t('coverImageNotFound') }}
}
@@ -317,14 +318,14 @@

- Unable to fetch metadata for this file + {{ t('unableToFetchMetadata') }}

@@ -490,3 +491,4 @@
} + diff --git a/booklore-ui/src/app/features/bookdrop/component/bookdrop-file-metadata-picker/bookdrop-file-metadata-picker.component.ts b/booklore-ui/src/app/features/bookdrop/component/bookdrop-file-metadata-picker/bookdrop-file-metadata-picker.component.ts index c210c49cc..9b915adbd 100644 --- a/booklore-ui/src/app/features/bookdrop/component/bookdrop-file-metadata-picker/bookdrop-file-metadata-picker.component.ts +++ b/booklore-ui/src/app/features/bookdrop/component/bookdrop-file-metadata-picker/bookdrop-file-metadata-picker.component.ts @@ -14,6 +14,7 @@ import {ConfirmationService} from 'primeng/api'; import {DatePicker} from 'primeng/datepicker'; import {ALL_METADATA_FIELDS, getArrayFields, getBottomFields, getTextareaFields, MetadataFieldConfig} from '../../../../shared/metadata'; import {MetadataUtilsService} from '../../../../shared/metadata'; +import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; @Component({ selector: 'app-bookdrop-file-metadata-picker-component', @@ -29,6 +30,7 @@ import {MetadataUtilsService} from '../../../../shared/metadata'; Image, LazyLoadImageModule, DatePicker, + TranslocoDirective, ], templateUrl: './bookdrop-file-metadata-picker.component.html', styleUrl: './bookdrop-file-metadata-picker.component.scss' @@ -38,6 +40,7 @@ export class BookdropFileMetadataPickerComponent { private readonly confirmationService = inject(ConfirmationService); private readonly metadataUtils = inject(MetadataUtilsService); protected readonly urlHelper = inject(UrlHelperService); + private readonly t = inject(TranslocoService); @Input() fetchedMetadata!: BookMetadata; @Input() originalMetadata?: BookMetadata; @@ -130,8 +133,8 @@ export class BookdropFileMetadataPickerComponent { confirmReset(): void { this.confirmationService.confirm({ - message: 'Are you sure you want to reset all metadata changes made to this file?', - header: 'Reset Metadata Changes?', + message: this.t.translate('bookdrop.metadataPicker.confirmResetMessage'), + header: this.t.translate('bookdrop.metadataPicker.confirmResetHeader'), icon: 'pi pi-exclamation-triangle', acceptButtonStyleClass: 'p-button-danger', accept: () => this.resetAll() diff --git a/booklore-ui/src/app/features/bookdrop/component/bookdrop-file-review/bookdrop-file-review.component.html b/booklore-ui/src/app/features/bookdrop/component/bookdrop-file-review/bookdrop-file-review.component.html index ac43c75bd..1bef88c44 100644 --- a/booklore-ui/src/app/features/bookdrop/component/bookdrop-file-review/bookdrop-file-review.component.html +++ b/booklore-ui/src/app/features/bookdrop/component/bookdrop-file-review/bookdrop-file-review.component.html @@ -1,31 +1,28 @@ +

- Review Bookdrop Files + {{ t('title') }}

-

- These files were uploaded to the - Bookdrop Folder. - Review their fetched metadata, assign a library and subpath, and finalize where they belong in your collection. -

+

@@ -36,7 +33,7 @@
- Loading Bookdrop files. Please wait... + {{ t('loadingMessage') }}
@@ -48,7 +45,7 @@
- Organizing and moving files to their designated libraries. Please wait... + {{ t('savingMessage') }}
@@ -62,14 +59,14 @@ size="small" outlined severity="info" - label="Import Metadata" + [label]="t('importMetadata')" icon="pi pi-copy" [disabled]="!hasSelectedFiles" (click)="copyMetadata()" - pTooltip="Import fetched metadata for selected files" + [pTooltip]="t('importMetadataTooltip')" tooltipPosition="top"> - + @@ -98,18 +95,18 @@ class="extractpattern" outlined severity="warn" - label="Extract Pattern" + [label]="t('extractPattern')" icon="pi pi-sliders-h" [disabled]="!hasSelectedFiles" (click)="openPatternExtractDialog()" - pTooltip="Extract metadata from selected filenames using a pattern" + [pTooltip]="t('extractPatternTooltip')" tooltipPosition="top">
@@ -127,7 +124,7 @@ [options]="selectedLibraryPaths" optionLabel="label" optionValue="value" - placeholder="Subpath" + [placeholder]="t('subpathPlaceholder')" appendTo="body" [(ngModel)]="defaultPathId"> @@ -138,7 +135,7 @@ severity="info" [disabled]="!canApplyDefaults" (click)="applyLibraryDefaults()" - pTooltip="Apply library and subpath to selected files" + [pTooltip]="t('applyLibraryTooltip')" tooltipPosition="top">
@@ -149,7 +146,7 @@
@if (bookdropFileUis.length === 0) {
- No bookdrop files to review. + {{ t('emptyState') }}
} @else { @for (file of bookdropFileUis; track file) { @@ -166,22 +163,22 @@ Cover } @else { -
?
+
?
} @if (file.file.fetchedMetadata?.thumbnailUrl) { Fetched Cover } @else { -
?
+
?
}
@@ -197,10 +194,10 @@ 'pi-exclamation-triangle not-applied': file.file.fetchedMetadata && !copiedFlags[file.file.id] }" [pTooltip]="copiedFlags[file.file.id] - ? 'Fetched metadata has been applied.' + ? t('metadataAppliedTooltip') : (!file.file.fetchedMetadata || !file.file.fetchedMetadata.title) - ? 'No fetched metadata available. Original metadata will be used.' - : 'Fetched metadata hasn’t been applied yet. Open metadata picker to review.'" + ? t('noMetadataTooltip') + : t('metadataNotAppliedTooltip')" tooltipPosition="top"> @@ -209,7 +206,7 @@ [options]="libraryOptions" optionLabel="label" optionValue="value" - placeholder="Library" + [placeholder]="t('libraryPlaceholder')" class="library-select" appendTo="body" [(ngModel)]="file.selectedLibraryId" @@ -221,7 +218,7 @@ [options]="file.availablePaths" optionLabel="name" optionValue="id" - placeholder="Subpath" + [placeholder]="t('subpathPlaceholder')" class="path-select" appendTo="body" [(ngModel)]="file.selectedPathId"> @@ -233,10 +230,10 @@ [icon]="file.showDetails ? 'pi pi-chevron-up' : 'pi pi-chevron-down'" (click)="file.showDetails = !file.showDetails" [pTooltip]="file.showDetails - ? 'Hide metadata' + ? t('hideMetadataTooltip') : file.file.fetchedMetadata?.title - ? 'Review and copy fetched metadata' - : 'Show file metadata (no fetched metadata)'" + ? t('reviewMetadataTooltip') + : t('showMetadataTooltip')" tooltipPosition="left">
@@ -270,27 +267,27 @@ @if (bookdropFileUis.length > 0) { - + } @else { @@ -315,33 +312,33 @@ @@ -349,3 +346,4 @@
}
+
diff --git a/booklore-ui/src/app/features/bookdrop/component/bookdrop-file-review/bookdrop-file-review.component.ts b/booklore-ui/src/app/features/bookdrop/component/bookdrop-file-review/bookdrop-file-review.component.ts index b9d8cacf4..a46057661 100644 --- a/booklore-ui/src/app/features/bookdrop/component/bookdrop-file-review/bookdrop-file-review.component.ts +++ b/booklore-ui/src/app/features/bookdrop/component/bookdrop-file-review/bookdrop-file-review.component.ts @@ -29,6 +29,7 @@ import {BookdropFileMetadataPickerComponent} from '../bookdrop-file-metadata-pic import {BookdropBulkEditDialogComponent, BulkEditResult} from '../bookdrop-bulk-edit-dialog/bookdrop-bulk-edit-dialog.component'; import {BookdropPatternExtractDialogComponent} from '../bookdrop-pattern-extract-dialog/bookdrop-pattern-extract-dialog.component'; import {DialogLauncherService} from '../../../../shared/services/dialog-launcher.service'; +import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; export interface BookdropFileUI { file: BookdropFile; @@ -60,6 +61,7 @@ export interface BookdropFileUI { Paginator, InputGroup, InputGroupAddonModule, + TranslocoDirective, ], }) export class BookdropFileReviewComponent implements OnInit { @@ -73,6 +75,7 @@ export class BookdropFileReviewComponent implements OnInit { private readonly urlHelper = inject(UrlHelperService); private readonly activatedRoute = inject(ActivatedRoute); private readonly pageTitle = inject(PageTitleService); + private readonly t = inject(TranslocoService); @ViewChildren('metadataPicker') metadataPickers!: QueryList; @@ -99,7 +102,7 @@ export class BookdropFileReviewComponent implements OnInit { excludedFiles = new Set(); ngOnInit(): void { - this.pageTitle.setPageTitle('Review Bookdrop Files'); + this.pageTitle.setPageTitle(this.t.translate('bookdrop.fileReview.title')); this.activatedRoute.queryParams .pipe(startWith({}), tap(() => { @@ -374,18 +377,18 @@ export class BookdropFileReviewComponent implements OnInit { if (selectedCount === 0) { this.messageService.add({ severity: 'warn', - summary: 'No files selected', - detail: 'Please select files to reset metadata.', + summary: this.t.translate('bookdrop.fileReview.toast.noFilesSelectedSummary'), + detail: this.t.translate('bookdrop.fileReview.toast.noFilesResetDetail'), }); return; } this.confirmationService.confirm({ - message: 'Are you sure you want to reset all metadata changes made to the selected files?', - header: 'Confirm Reset', + message: this.t.translate('bookdrop.fileReview.toast.confirmResetMessage'), + header: this.t.translate('bookdrop.fileReview.toast.confirmResetHeader'), icon: 'pi pi-exclamation-triangle', - acceptLabel: 'Reset', - rejectLabel: 'Cancel', + acceptLabel: this.t.translate('bookdrop.fileReview.toast.confirmResetAccept'), + rejectLabel: this.t.translate('common.cancel'), rejectButtonProps: { severity: 'secondary', outlined: true @@ -403,18 +406,18 @@ export class BookdropFileReviewComponent implements OnInit { if (selectedCount === 0) { this.messageService.add({ severity: 'warn', - summary: 'No files selected', - detail: 'Please select files to finalize.', + summary: this.t.translate('bookdrop.fileReview.toast.noFilesSelectedSummary'), + detail: this.t.translate('bookdrop.fileReview.toast.noFilesFinalizeDetail'), }); return; } this.confirmationService.confirm({ - message: `Are you sure you want to finalize the import of ${selectedCount} file${selectedCount !== 1 ? 's' : ''}?`, - header: 'Confirm Finalize', + message: this.t.translate('bookdrop.fileReview.toast.confirmFinalizeMessage', {count: selectedCount}), + header: this.t.translate('bookdrop.fileReview.toast.confirmFinalizeHeader'), icon: 'pi pi-exclamation-triangle', - acceptLabel: 'Finalize', - rejectLabel: 'Cancel', + acceptLabel: this.t.translate('bookdrop.fileReview.toast.confirmFinalizeAccept'), + rejectLabel: this.t.translate('common.cancel'), rejectButtonProps: { severity: 'secondary', outlined: true @@ -432,18 +435,18 @@ export class BookdropFileReviewComponent implements OnInit { if (selectedCount === 0) { this.messageService.add({ severity: 'warn', - summary: 'No files selected', - detail: 'Please select files to delete.', + summary: this.t.translate('bookdrop.fileReview.toast.noFilesSelectedSummary'), + detail: this.t.translate('bookdrop.fileReview.toast.noFilesDeleteDetail'), }); return; } this.confirmationService.confirm({ - message: `Are you sure you want to delete ${selectedCount} selected Bookdrop file${selectedCount !== 1 ? 's' : ''}? This action cannot be undone.`, - header: 'Confirm Delete', + message: this.t.translate('bookdrop.fileReview.toast.confirmDeleteMessage', {count: selectedCount}), + header: this.t.translate('bookdrop.fileReview.toast.confirmDeleteHeader'), icon: 'pi pi-exclamation-triangle', - acceptLabel: 'Delete', - rejectLabel: 'Cancel', + acceptLabel: this.t.translate('bookdrop.fileReview.toast.confirmDeleteAccept'), + rejectLabel: this.t.translate('common.cancel'), rejectButtonProps: { severity: 'secondary', outlined: true @@ -469,8 +472,8 @@ export class BookdropFileReviewComponent implements OnInit { next: () => { this.messageService.add({ severity: 'success', - summary: 'Files Deleted', - detail: 'Selected Bookdrop files were deleted successfully.', + summary: this.t.translate('bookdrop.fileReview.toast.filesDeletedSummary'), + detail: this.t.translate('bookdrop.fileReview.toast.filesDeletedDetail'), }); this.getSelectedFiles().forEach(file => delete this.fileUiCache[file.file.id]); @@ -483,8 +486,8 @@ export class BookdropFileReviewComponent implements OnInit { console.error('Error deleting files:', err); this.messageService.add({ severity: 'error', - summary: 'Delete Failed', - detail: 'An error occurred while deleting Bookdrop files.', + summary: this.t.translate('bookdrop.fileReview.toast.deleteFailedSummary'), + detail: this.t.translate('bookdrop.fileReview.toast.deleteFailedDetail'), }); }, }); @@ -549,8 +552,8 @@ export class BookdropFileReviewComponent implements OnInit { this.messageService.add({ severity: 'success', - summary: 'Import Complete', - detail: 'Import process finished. See details below.', + summary: this.t.translate('bookdrop.fileReview.toast.importCompleteSummary'), + detail: this.t.translate('bookdrop.fileReview.toast.importCompleteDetail'), }); this.dialogLauncherService.openBookdropFinalizeResultDialog(result); @@ -569,8 +572,8 @@ export class BookdropFileReviewComponent implements OnInit { console.error('Error finalizing import:', err); this.messageService.add({ severity: 'error', - summary: 'Import Failed', - detail: 'Some files could not be moved. Please check the console for more details.', + summary: this.t.translate('bookdrop.fileReview.toast.importFailedSummary'), + detail: this.t.translate('bookdrop.fileReview.toast.importFailedDetail'), }); this.saving = false; } @@ -635,15 +638,15 @@ export class BookdropFileReviewComponent implements OnInit { next: () => { this.messageService.add({ severity: 'success', - summary: 'Rescan Triggered', - detail: 'Bookdrop rescan has been started successfully.', + summary: this.t.translate('bookdrop.fileReview.toast.rescanTriggeredSummary'), + detail: this.t.translate('bookdrop.fileReview.toast.rescanTriggeredDetail'), }); }, error: (err) => { this.messageService.add({ severity: 'error', - summary: 'Rescan Failed', - detail: 'Unable to trigger bookdrop rescan. Please try again.', + summary: this.t.translate('bookdrop.fileReview.toast.rescanFailedSummary'), + detail: this.t.translate('bookdrop.fileReview.toast.rescanFailedDetail'), }); console.error(err); } @@ -659,14 +662,14 @@ export class BookdropFileReviewComponent implements OnInit { if (totalCount === 0) { this.messageService.add({ severity: 'warn', - summary: 'No files selected', - detail: 'Please select files to bulk edit.', + summary: this.t.translate('bookdrop.fileReview.toast.noFilesSelectedSummary'), + detail: this.t.translate('bookdrop.fileReview.toast.noFilesBulkEditDetail'), }); return; } const dialogRef = this.dialogLauncherService.openDialog(BookdropBulkEditDialogComponent, { - header: `Bulk Edit ${totalCount} Files`, + header: this.t.translate('bookdrop.fileReview.toast.bulkEditDialogHeader', {count: totalCount}), width: '600px', modal: true, closable: true, @@ -689,8 +692,8 @@ export class BookdropFileReviewComponent implements OnInit { if (totalCount === 0) { this.messageService.add({ severity: 'warn', - summary: 'No files selected', - detail: 'Please select files to extract metadata from.', + summary: this.t.translate('bookdrop.fileReview.toast.noFilesSelectedSummary'), + detail: this.t.translate('bookdrop.fileReview.toast.noFilesExtractDetail'), }); return; } @@ -699,7 +702,7 @@ export class BookdropFileReviewComponent implements OnInit { const selectedIds = selectedFiles.map(f => f.file.id); const dialogRef = this.dialogLauncherService.openDialog(BookdropPatternExtractDialogComponent, { - header: 'Extract Metadata from Filenames', + header: this.t.translate('bookdrop.fileReview.toast.extractMetadataDialogHeader'), width: '700px', modal: true, closable: true, @@ -736,8 +739,8 @@ export class BookdropFileReviewComponent implements OnInit { console.error('Error loading pages into cache:', err); this.messageService.add({ severity: 'error', - summary: 'Bulk Edit Failed', - detail: 'An error occurred while loading files into cache.', + summary: this.t.translate('bookdrop.fileReview.toast.bulkEditFailedSummary'), + detail: this.t.translate('bookdrop.fileReview.toast.bulkEditCacheFailedDetail'), }); return; } @@ -763,16 +766,16 @@ export class BookdropFileReviewComponent implements OnInit { next: (backendResult: BackendBulkEditResult) => { this.messageService.add({ severity: 'success', - summary: 'Bulk Edit Applied', - detail: `Updated metadata for ${backendResult.successfullyUpdated} of ${backendResult.totalFiles} file(s).`, + summary: this.t.translate('bookdrop.fileReview.toast.bulkEditAppliedSummary'), + detail: this.t.translate('bookdrop.fileReview.toast.bulkEditAppliedDetail', {success: backendResult.successfullyUpdated, total: backendResult.totalFiles}), }); }, error: (err) => { console.error('Error applying bulk edit:', err); this.messageService.add({ severity: 'error', - summary: 'Bulk Edit Failed', - detail: 'An error occurred while applying bulk edits.', + summary: this.t.translate('bookdrop.fileReview.toast.bulkEditFailedSummary'), + detail: this.t.translate('bookdrop.fileReview.toast.bulkEditFailedDetail'), }); }, }); @@ -814,8 +817,8 @@ export class BookdropFileReviewComponent implements OnInit { console.error('Error loading pages into cache:', err); this.messageService.add({ severity: 'error', - summary: 'Pattern Extraction Failed', - detail: 'An error occurred while loading files into cache.', + summary: this.t.translate('bookdrop.fileReview.toast.patternExtractionCacheFailedSummary'), + detail: this.t.translate('bookdrop.fileReview.toast.patternExtractionCacheFailedDetail'), }); return; } @@ -849,8 +852,8 @@ export class BookdropFileReviewComponent implements OnInit { this.messageService.add({ severity: 'success', - summary: 'Pattern Extraction Applied', - detail: `Applied extracted metadata to ${appliedCount} file(s).`, + summary: this.t.translate('bookdrop.fileReview.toast.patternExtractionAppliedSummary'), + detail: this.t.translate('bookdrop.fileReview.toast.patternExtractionAppliedDetail', {count: appliedCount}), }); } } diff --git a/booklore-ui/src/app/features/bookdrop/component/bookdrop-files-widget/bookdrop-files-widget.component.html b/booklore-ui/src/app/features/bookdrop/component/bookdrop-files-widget/bookdrop-files-widget.component.html index b51e65bb6..b3791ca66 100644 --- a/booklore-ui/src/app/features/bookdrop/component/bookdrop-files-widget/bookdrop-files-widget.component.html +++ b/booklore-ui/src/app/features/bookdrop/component/bookdrop-files-widget/bookdrop-files-widget.component.html @@ -1,12 +1,13 @@ +
-

Pending Bookdrop Files

+

{{ t('title') }}

{{ pendingCount }}

@if (lastUpdatedAt) {

- Last updated: {{ lastUpdatedAt | date: 'short' }} + {{ t('lastUpdated') }} {{ lastUpdatedAt | date: 'short' }}

}
@@ -17,8 +18,9 @@ outlined severity="info" (click)="openReviewDialog()"> - Review + {{ t('reviewBtn') }}
+ diff --git a/booklore-ui/src/app/features/bookdrop/component/bookdrop-files-widget/bookdrop-files-widget.component.ts b/booklore-ui/src/app/features/bookdrop/component/bookdrop-files-widget/bookdrop-files-widget.component.ts index b3b196df8..ad57d6e63 100644 --- a/booklore-ui/src/app/features/bookdrop/component/bookdrop-files-widget/bookdrop-files-widget.component.ts +++ b/booklore-ui/src/app/features/bookdrop/component/bookdrop-files-widget/bookdrop-files-widget.component.ts @@ -5,6 +5,7 @@ import {BookdropFileNotification, BookdropFileService} from '../../service/bookd import {DatePipe} from '@angular/common'; import {Router} from '@angular/router'; import {Button} from 'primeng/button'; +import {TranslocoDirective} from '@jsverse/transloco'; @Component({ selector: 'app-bookdrop-files-widget-component', @@ -13,7 +14,8 @@ import {Button} from 'primeng/button'; styleUrl: './bookdrop-files-widget.component.scss', imports: [ DatePipe, - Button + Button, + TranslocoDirective ] }) export class BookdropFilesWidgetComponent implements OnInit, OnDestroy { diff --git a/booklore-ui/src/app/features/bookdrop/component/bookdrop-finalize-result-dialog/bookdrop-finalize-result-dialog.component.html b/booklore-ui/src/app/features/bookdrop/component/bookdrop-finalize-result-dialog/bookdrop-finalize-result-dialog.component.html index 20fc1abd0..7c795e7dc 100644 --- a/booklore-ui/src/app/features/bookdrop/component/bookdrop-finalize-result-dialog/bookdrop-finalize-result-dialog.component.html +++ b/booklore-ui/src/app/features/bookdrop/component/bookdrop-finalize-result-dialog/bookdrop-finalize-result-dialog.component.html @@ -1,11 +1,12 @@ +
-

Import Summary

-

Results of your book import

+

{{ t('panelTitle') }}

+

{{ t('panelDescription') }}

{{ result.totalFiles }}
-
Total Files
+
{{ t('totalFiles') }}
{{ result.successfullyImported }}
-
Successfully Imported
+
{{ t('successfullyImported') }}
{{ result.failed }}
-
Failed
+
{{ t('failed') }}
-
Processed at
+
{{ t('processedAt') }}
{{ result.processedAt | date:'medium' }}
@@ -65,3 +66,4 @@
+ diff --git a/booklore-ui/src/app/features/bookdrop/component/bookdrop-finalize-result-dialog/bookdrop-finalize-result-dialog.component.ts b/booklore-ui/src/app/features/bookdrop/component/bookdrop-finalize-result-dialog/bookdrop-finalize-result-dialog.component.ts index f52d19409..03b8e080f 100644 --- a/booklore-ui/src/app/features/bookdrop/component/bookdrop-finalize-result-dialog/bookdrop-finalize-result-dialog.component.ts +++ b/booklore-ui/src/app/features/bookdrop/component/bookdrop-finalize-result-dialog/bookdrop-finalize-result-dialog.component.ts @@ -3,13 +3,15 @@ import {DatePipe, NgClass} from '@angular/common'; import {BookdropFinalizeResult} from '../../service/bookdrop.service'; import {DynamicDialogConfig, DynamicDialogRef} from "primeng/dynamicdialog"; import {Button} from 'primeng/button'; +import {TranslocoDirective} from '@jsverse/transloco'; @Component({ selector: 'app-bookdrop-finalize-result-dialog', imports: [ NgClass, DatePipe, - Button + Button, + TranslocoDirective ], templateUrl: './bookdrop-finalize-result-dialog.component.html', styleUrl: './bookdrop-finalize-result-dialog.component.scss' diff --git a/booklore-ui/src/app/features/bookdrop/component/bookdrop-pattern-extract-dialog/bookdrop-pattern-extract-dialog.component.html b/booklore-ui/src/app/features/bookdrop/component/bookdrop-pattern-extract-dialog/bookdrop-pattern-extract-dialog.component.html index fbbed90b3..cef28f8ac 100644 --- a/booklore-ui/src/app/features/bookdrop/component/bookdrop-pattern-extract-dialog/bookdrop-pattern-extract-dialog.component.html +++ b/booklore-ui/src/app/features/bookdrop/component/bookdrop-pattern-extract-dialog/bookdrop-pattern-extract-dialog.component.html @@ -1,39 +1,37 @@ +
- - Enter a pattern to extract metadata from filenames of {{ fileCount }} selected file(s). - Use placeholders like {{ '{' }}SeriesName{{ '}' }} to capture values. - +
-

Pattern

+

{{ t('patternTitle') }}

-

Available Placeholders

+

{{ t('availablePlaceholdersTitle') }}

@for (placeholder of availablePlaceholders; track placeholder.name) {
-

Common Patterns

+

{{ t('commonPatternsTitle') }}

@for (commonPattern of commonPatterns; track commonPattern.pattern) { 0) {
-

Preview (Sample Files)

+

{{ t('previewTitle') }}

@for (preview of previewResults; track preview.fileName) {
@@ -102,18 +100,18 @@ @if (isExtracting) {
- Extracting metadata... + {{ t('extractingMessage') }}
}
+ diff --git a/booklore-ui/src/app/features/bookdrop/component/bookdrop-pattern-extract-dialog/bookdrop-pattern-extract-dialog.component.ts b/booklore-ui/src/app/features/bookdrop/component/bookdrop-pattern-extract-dialog/bookdrop-pattern-extract-dialog.component.ts index 509de563f..eeb9a8f9d 100644 --- a/booklore-ui/src/app/features/bookdrop/component/bookdrop-pattern-extract-dialog/bookdrop-pattern-extract-dialog.component.ts +++ b/booklore-ui/src/app/features/bookdrop/component/bookdrop-pattern-extract-dialog/bookdrop-pattern-extract-dialog.component.ts @@ -10,11 +10,12 @@ import {BookdropService, PatternExtractResult} from '../../service/bookdrop.serv import {MessageService} from 'primeng/api'; import {NgClass} from '@angular/common'; import {Tooltip} from 'primeng/tooltip'; +import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco'; interface PatternPlaceholder { name: string; - description: string; - example: string; + descriptionKey: string; + exampleKey: string; } interface PreviewResult { @@ -24,6 +25,22 @@ interface PreviewResult { errorMessage?: string; } +const PLACEHOLDER_KEY_MAP: Record = { + '*': 'wildcard', + 'SeriesName': 'seriesName', + 'Title': 'title', + 'Subtitle': 'subtitle', + 'Authors': 'authors', + 'SeriesNumber': 'seriesNumber', + 'Published': 'published', + 'Publisher': 'publisher', + 'Language': 'language', + 'SeriesTotal': 'seriesTotal', + 'ISBN10': 'isbn10', + 'ISBN13': 'isbn13', + 'ASIN': 'asin', +}; + @Component({ selector: 'app-bookdrop-pattern-extract-dialog', standalone: true, @@ -36,6 +53,8 @@ interface PreviewResult { ProgressSpinner, NgClass, Tooltip, + TranslocoDirective, + TranslocoPipe, ], templateUrl: './bookdrop-pattern-extract-dialog.component.html', styleUrl: './bookdrop-pattern-extract-dialog.component.scss' @@ -46,6 +65,7 @@ export class BookdropPatternExtractDialogComponent implements OnInit { private readonly config = inject(DynamicDialogConfig); private readonly bookdropService = inject(BookdropService); private readonly messageService = inject(MessageService); + private readonly t = inject(TranslocoService); @ViewChild('patternInput', {static: false}) patternInput?: ElementRef; @@ -57,7 +77,6 @@ export class BookdropPatternExtractDialogComponent implements OnInit { isExtracting = false; previewResults: PreviewResult[] = []; - patternPlaceholderText = 'e.g., {SeriesName} - Ch {SeriesNumber}'; spinnerStyle = {width: '24px', height: '24px'}; patternForm = new FormGroup({ @@ -65,32 +84,32 @@ export class BookdropPatternExtractDialogComponent implements OnInit { }); availablePlaceholders: PatternPlaceholder[] = [ - {name: '*', description: 'Wildcard - skips any text (not a metadata field)', example: 'anything'}, - {name: 'SeriesName', description: 'Series or comic name', example: 'Chronicles of Earth'}, - {name: 'Title', description: 'Book title', example: 'The Lost City'}, - {name: 'Subtitle', description: 'Book subtitle', example: 'A Tale of Adventure'}, - {name: 'Authors', description: 'Author name(s)', example: 'John Smith'}, - {name: 'SeriesNumber', description: 'Book number in series', example: '25'}, - {name: 'Published', description: 'Full date with format', example: '{Published:yyyy-MM-dd}'}, - {name: 'Publisher', description: 'Publisher name', example: 'Epic Press'}, - {name: 'Language', description: 'Language code', example: 'en'}, - {name: 'SeriesTotal', description: 'Total books in series', example: '50'}, - {name: 'ISBN10', description: 'ISBN-10 identifier', example: '1234567890'}, - {name: 'ISBN13', description: 'ISBN-13 identifier', example: '1234567890123'}, - {name: 'ASIN', description: 'Amazon ASIN', example: 'B012345678'}, + {name: '*', descriptionKey: 'placeholders.wildcard', exampleKey: 'placeholderExamples.wildcard'}, + {name: 'SeriesName', descriptionKey: 'placeholders.seriesName', exampleKey: 'placeholderExamples.seriesName'}, + {name: 'Title', descriptionKey: 'placeholders.title', exampleKey: 'placeholderExamples.title'}, + {name: 'Subtitle', descriptionKey: 'placeholders.subtitle', exampleKey: 'placeholderExamples.subtitle'}, + {name: 'Authors', descriptionKey: 'placeholders.authors', exampleKey: 'placeholderExamples.authors'}, + {name: 'SeriesNumber', descriptionKey: 'placeholders.seriesNumber', exampleKey: 'placeholderExamples.seriesNumber'}, + {name: 'Published', descriptionKey: 'placeholders.published', exampleKey: 'placeholderExamples.published'}, + {name: 'Publisher', descriptionKey: 'placeholders.publisher', exampleKey: 'placeholderExamples.publisher'}, + {name: 'Language', descriptionKey: 'placeholders.language', exampleKey: 'placeholderExamples.language'}, + {name: 'SeriesTotal', descriptionKey: 'placeholders.seriesTotal', exampleKey: 'placeholderExamples.seriesTotal'}, + {name: 'ISBN10', descriptionKey: 'placeholders.isbn10', exampleKey: 'placeholderExamples.isbn10'}, + {name: 'ISBN13', descriptionKey: 'placeholders.isbn13', exampleKey: 'placeholderExamples.isbn13'}, + {name: 'ASIN', descriptionKey: 'placeholders.asin', exampleKey: 'placeholderExamples.asin'}, ]; commonPatterns = [ - {label: 'Author - Title', pattern: '{Authors} - {Title}'}, - {label: 'Title - Author', pattern: '{Title} - {Authors}'}, - {label: 'Title (Year)', pattern: '{Title} ({Published:yyyy})'}, - {label: 'Author - Title (Year)', pattern: '{Authors} - {Title} ({Published:yyyy})'}, - {label: 'Series #Number', pattern: '{SeriesName} #{SeriesNumber}'}, - {label: 'Series - Chapter Number', pattern: '{SeriesName} - Chapter {SeriesNumber}'}, - {label: 'Series - Vol Number', pattern: '{SeriesName} - Vol {SeriesNumber}'}, - {label: '[Tag] Series - Chapter Number', pattern: '[*] {SeriesName} - Chapter {SeriesNumber}'}, - {label: 'Title by Author', pattern: '{Title} by {Authors}'}, - {label: 'Series vX (of Total)', pattern: '{SeriesName} v{SeriesNumber} (of {SeriesTotal})'}, + {labelKey: 'commonPatternLabels.authorTitle', pattern: '{Authors} - {Title}'}, + {labelKey: 'commonPatternLabels.titleAuthor', pattern: '{Title} - {Authors}'}, + {labelKey: 'commonPatternLabels.titleYear', pattern: '{Title} ({Published:yyyy})'}, + {labelKey: 'commonPatternLabels.authorTitleYear', pattern: '{Authors} - {Title} ({Published:yyyy})'}, + {labelKey: 'commonPatternLabels.seriesNumber', pattern: '{SeriesName} #{SeriesNumber}'}, + {labelKey: 'commonPatternLabels.seriesChapter', pattern: '{SeriesName} - Chapter {SeriesNumber}'}, + {labelKey: 'commonPatternLabels.seriesVol', pattern: '{SeriesName} - Vol {SeriesNumber}'}, + {labelKey: 'commonPatternLabels.tagSeriesChapter', pattern: '[*] {SeriesName} - Chapter {SeriesNumber}'}, + {labelKey: 'commonPatternLabels.titleByAuthor', pattern: '{Title} by {Authors}'}, + {labelKey: 'commonPatternLabels.seriesVTotal', pattern: '{SeriesName} v{SeriesNumber} (of {SeriesTotal})'}, ]; ngOnInit(): void { @@ -104,23 +123,23 @@ export class BookdropPatternExtractDialogComponent implements OnInit { const patternControl = this.patternForm.get('pattern'); const currentPattern = patternControl?.value ?? ''; const inputElement = this.patternInput?.nativeElement; - + const textToInsert = placeholderName === '*' ? '*' : `{${placeholderName}}`; - - const patternToModify = placeholderName === '*' - ? currentPattern + + const patternToModify = placeholderName === '*' + ? currentPattern : this.removeExistingPlaceholder(currentPattern, placeholderName); - + if (inputElement) { const cursorPosition = this.calculateCursorPosition(inputElement, currentPattern, patternToModify); const newPattern = this.insertTextAtCursor(patternToModify, textToInsert, cursorPosition); - + patternControl?.setValue(newPattern); this.focusInputAfterInsertion(inputElement, cursorPosition, textToInsert.length); } else { patternControl?.setValue(patternToModify + textToInsert); } - + this.previewPattern(); } @@ -131,7 +150,7 @@ export class BookdropPatternExtractDialogComponent implements OnInit { private calculateCursorPosition(inputElement: HTMLInputElement, originalPattern: string, modifiedPattern: string): number { let cursorPosition = inputElement.selectionStart ?? modifiedPattern.length; - + if (originalPattern !== modifiedPattern) { const existingPlaceholderRegex = new RegExp(`\\{\\w+(?::[^}]*)?\\}`, 'g'); const matchBefore = originalPattern.substring(0, cursorPosition).match(existingPlaceholderRegex); @@ -140,7 +159,7 @@ export class BookdropPatternExtractDialogComponent implements OnInit { } cursorPosition = Math.max(0, cursorPosition); } - + return cursorPosition; } @@ -218,8 +237,11 @@ export class BookdropPatternExtractDialogComponent implements OnInit { this.isExtracting = false; this.messageService.add({ severity: 'success', - summary: 'Extraction Complete', - detail: `Successfully extracted metadata from ${result.successfullyExtracted} of ${result.totalFiles} files.`, + summary: this.t.translate('bookdrop.patternExtract.toast.extractionCompleteSummary'), + detail: this.t.translate('bookdrop.patternExtract.toast.extractionCompleteDetail', { + success: result.successfullyExtracted, + total: result.totalFiles + }), }); this.dialogRef.close(result); }, @@ -228,8 +250,8 @@ export class BookdropPatternExtractDialogComponent implements OnInit { console.error('Pattern extraction failed:', err); this.messageService.add({ severity: 'error', - summary: 'Extraction Failed', - detail: 'An error occurred during pattern extraction.', + summary: this.t.translate('bookdrop.patternExtract.toast.extractionFailedSummary'), + detail: this.t.translate('bookdrop.patternExtract.toast.extractionFailedDetail'), }); }, }); @@ -253,7 +275,13 @@ export class BookdropPatternExtractDialogComponent implements OnInit { } getPlaceholderTooltip(placeholder: PatternPlaceholder): string { - return `${placeholder.description} (e.g., ${placeholder.example})`; + const description = this.t.translate(`bookdrop.patternExtract.${placeholder.descriptionKey}`); + const example = this.t.translate(`bookdrop.patternExtract.${placeholder.exampleKey}`); + return `${description} (e.g., ${example})`; + } + + getCommonPatternLabel(labelKey: string): string { + return this.t.translate(`bookdrop.patternExtract.${labelKey}`); } getPreviewClass(preview: PreviewResult): Record { @@ -272,10 +300,10 @@ export class BookdropPatternExtractDialogComponent implements OnInit { } getErrorMessage(preview: PreviewResult): string { - return preview.errorMessage || 'Pattern did not match'; + return preview.errorMessage || this.t.translate('bookdrop.patternExtract.patternDidNotMatch'); } getErrorTooltip(preview: PreviewResult): string { - return preview.success ? '' : (preview.errorMessage || 'Pattern did not match filename structure'); + return preview.success ? '' : (preview.errorMessage || this.t.translate('bookdrop.patternExtract.patternDidNotMatchStructure')); } } diff --git a/booklore-ui/src/app/features/dashboard/components/dashboard-scroller/dashboard-scroller.component.html b/booklore-ui/src/app/features/dashboard/components/dashboard-scroller/dashboard-scroller.component.html index 8e54a8e0e..640f46310 100644 --- a/booklore-ui/src/app/features/dashboard/components/dashboard-scroller/dashboard-scroller.component.html +++ b/booklore-ui/src/app/features/dashboard/components/dashboard-scroller/dashboard-scroller.component.html @@ -1,47 +1,49 @@ -
-

- {{ title }} - @if (isMagicShelf) { - - } -

- - @if (!books || books.length === 0) { -
-
- -
-

No books found for this scroller.

-
- } - - @if (books) { -
- @for (book of books; track book.id) { -
- -
+ +
+

+ {{ title }} + @if (isMagicShelf) { + } -

- } + - @if (books === null) { -
-
- + @if (!books || books.length === 0) { +
+
+ +
+

{{ t('noBooksFound') }}

-

Failed to load books! Please try refreshing the page.

-
- } -
+ } + + @if (books) { +
+ @for (book of books; track book.id) { +
+ +
+ } +
+ } + + @if (books === null) { +
+
+ +
+

{{ t('loadError') }}

+
+ } +
+ diff --git a/booklore-ui/src/app/features/dashboard/components/dashboard-scroller/dashboard-scroller.component.ts b/booklore-ui/src/app/features/dashboard/components/dashboard-scroller/dashboard-scroller.component.ts index b399bfa4e..ccba485d3 100644 --- a/booklore-ui/src/app/features/dashboard/components/dashboard-scroller/dashboard-scroller.component.ts +++ b/booklore-ui/src/app/features/dashboard/components/dashboard-scroller/dashboard-scroller.component.ts @@ -7,6 +7,7 @@ import {ProgressSpinnerModule} from 'primeng/progressspinner'; import {Book} from '../../../book/model/book.model'; import {ScrollerType} from '../../models/dashboard-config.model'; import { BookCardOverlayPreferenceService } from '../../../book/components/book-browser/book-card-overlay-preference.service'; +import {TranslocoDirective} from '@jsverse/transloco'; @Component({ selector: 'app-dashboard-scroller', @@ -16,7 +17,8 @@ import { BookCardOverlayPreferenceService } from '../../../book/components/book- InfiniteScrollDirective, BookCardComponent, ProgressSpinnerModule, - NgClass + NgClass, + TranslocoDirective ], standalone: true }) diff --git a/booklore-ui/src/app/features/dashboard/components/dashboard-settings/dashboard-settings.component.html b/booklore-ui/src/app/features/dashboard/components/dashboard-settings/dashboard-settings.component.html index 87c1adcf4..a9ca6beb2 100644 --- a/booklore-ui/src/app/features/dashboard/components/dashboard-settings/dashboard-settings.component.html +++ b/booklore-ui/src/app/features/dashboard/components/dashboard-settings/dashboard-settings.component.html @@ -1,154 +1,156 @@ -
-
-
- + +
+
+
+ +
+
+

{{ t('title') }}

+

{{ t('description') }}

+
+
-
-

Dashboard Configuration

-

Add up to 5 scrollers from different book collections and customize their behavior

-
- -
-
- @for (scroller of config.scrollers; track scroller.id; let i = $index) { -
-
-
- -
- -
-
- - - +
+ @for (scroller of config.scrollers; track scroller.id; let i = $index) { +
+
+
+
- @if (scroller.type === 'magicShelf') { -
- +
+
+
-
- - - -
+ @if (scroller.type === 'magicShelf') { +
+ + + +
-
- - - -
- } -
+
+ + + +
-
- - - -
+
+ + + +
+ } +
-
- - - - - - +
+ + + +
+ +
+ + + + + + +
-
- } -
+ } +
- + diff --git a/booklore-ui/src/app/features/dashboard/components/dashboard-settings/dashboard-settings.component.ts b/booklore-ui/src/app/features/dashboard/components/dashboard-settings/dashboard-settings.component.ts index 23c6fd803..8561a5536 100644 --- a/booklore-ui/src/app/features/dashboard/components/dashboard-settings/dashboard-settings.component.ts +++ b/booklore-ui/src/app/features/dashboard/components/dashboard-settings/dashboard-settings.component.ts @@ -1,4 +1,5 @@ -import {Component, inject, OnInit} from '@angular/core'; +import {Component, DestroyRef, inject, OnInit} from '@angular/core'; +import {takeUntilDestroyed} from '@angular/core/rxjs-interop'; import {CommonModule} from '@angular/common'; import {FormsModule} from '@angular/forms'; import {DynamicDialogRef} from 'primeng/dynamicdialog'; @@ -11,6 +12,7 @@ import {DashboardConfig, ScrollerConfig, ScrollerType} from '../../models/dashbo import {DashboardConfigService} from '../../services/dashboard-config.service'; import {MagicShelfService} from '../../../magic-shelf/service/magic-shelf.service'; import {map} from 'rxjs/operators'; +import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco'; export const MAX_SCROLLERS = 5; export const DEFAULT_MAX_ITEMS = 20; @@ -27,7 +29,9 @@ export const MAX_ITEMS = 20; CheckboxModule, InputTextModule, SelectModule, - InputNumberModule + InputNumberModule, + TranslocoDirective, + TranslocoPipe ], templateUrl: './dashboard-settings.component.html', styleUrls: ['./dashboard-settings.component.scss'] @@ -36,16 +40,14 @@ export class DashboardSettingsComponent implements OnInit { private configService = inject(DashboardConfigService); private dialogRef = inject(DynamicDialogRef); private magicShelfService = inject(MagicShelfService); + private translocoService = inject(TranslocoService); + private destroyRef = inject(DestroyRef); config!: DashboardConfig; - availableScrollerTypes = [ - {label: 'Continue Reading', value: ScrollerType.LAST_READ}, - {label: 'Continue Listening', value: ScrollerType.LAST_LISTENED}, - {label: 'Recently Added', value: ScrollerType.LATEST_ADDED}, - {label: 'Discover Something New', value: ScrollerType.RANDOM}, - {label: 'Magic Shelf', value: ScrollerType.MAGIC_SHELF} - ]; + availableScrollerTypes: {label: string; value: ScrollerType}[] = []; + sortFieldOptions: {label: string; value: string}[] = []; + sortDirectionOptions: {label: string; value: string}[] = []; magicShelves$ = this.magicShelfService.shelvesState$.pipe( map(state => (state.shelves || []).map(shelf => ({ @@ -54,33 +56,16 @@ export class DashboardSettingsComponent implements OnInit { }))) ); - sortFieldOptions = [ - {label: 'Title', value: 'title'}, - {label: 'Title + Series', value: 'titleSeries'}, - {label: 'File Name', value: 'fileName'}, - {label: 'File Path', value: 'filePath'}, - {label: 'Date Added', value: 'addedOn'}, - {label: 'Author', value: 'author'}, - {label: 'Author (Surname)', value: 'authorSurnameVorname'}, - {label: 'Author + Series', value: 'authorSeries'}, - {label: 'Personal Rating', value: 'personalRating'}, - {label: 'Publisher', value: 'publisher'}, - {label: 'Published Date', value: 'publishedDate'}, - {label: 'Last Read', value: 'lastReadTime'}, - {label: 'Pages', value: 'pageCount'} - ]; - - sortDirectionOptions = [ - {label: 'Ascending', value: 'asc'}, - {label: 'Descending', value: 'desc'} - ]; - private magicShelvesMap = new Map(); readonly MIN_ITEMS = MIN_ITEMS; readonly MAX_ITEMS = MAX_ITEMS; ngOnInit(): void { + this.translocoService.langChanges$ + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe(() => this.buildTranslatedOptions()); + this.configService.config$.subscribe(config => { this.config = JSON.parse(JSON.stringify(config)); }); @@ -95,22 +80,57 @@ export class DashboardSettingsComponent implements OnInit { }); } + private buildTranslatedOptions(): void { + const t = (key: string) => this.translocoService.translate(`dashboard.settings.${key}`); + + this.availableScrollerTypes = [ + {label: t('scrollerTypes.lastRead'), value: ScrollerType.LAST_READ}, + {label: t('scrollerTypes.lastListened'), value: ScrollerType.LAST_LISTENED}, + {label: t('scrollerTypes.latestAdded'), value: ScrollerType.LATEST_ADDED}, + {label: t('scrollerTypes.random'), value: ScrollerType.RANDOM}, + {label: t('scrollerTypes.magicShelf'), value: ScrollerType.MAGIC_SHELF} + ]; + + this.sortFieldOptions = [ + {label: t('sortFields.title'), value: 'title'}, + {label: t('sortFields.titleSeries'), value: 'titleSeries'}, + {label: t('sortFields.fileName'), value: 'fileName'}, + {label: t('sortFields.filePath'), value: 'filePath'}, + {label: t('sortFields.addedOn'), value: 'addedOn'}, + {label: t('sortFields.author'), value: 'author'}, + {label: t('sortFields.authorSurnameVorname'), value: 'authorSurnameVorname'}, + {label: t('sortFields.authorSeries'), value: 'authorSeries'}, + {label: t('sortFields.personalRating'), value: 'personalRating'}, + {label: t('sortFields.publisher'), value: 'publisher'}, + {label: t('sortFields.publishedDate'), value: 'publishedDate'}, + {label: t('sortFields.lastReadTime'), value: 'lastReadTime'}, + {label: t('sortFields.pageCount'), value: 'pageCount'} + ]; + + this.sortDirectionOptions = [ + {label: t('sortDirections.asc'), value: 'asc'}, + {label: t('sortDirections.desc'), value: 'desc'} + ]; + } + getScrollerTitle(scroller: ScrollerConfig): string { + const t = (key: string) => this.translocoService.translate(`dashboard.settings.scrollerTypes.${key}`); + if (scroller.type === ScrollerType.MAGIC_SHELF && scroller.magicShelfId) { - return this.magicShelvesMap.get(scroller.magicShelfId) || 'Magic Shelf'; + return this.magicShelvesMap.get(scroller.magicShelfId) || t('magicShelf'); } switch (scroller.type) { case ScrollerType.LAST_READ: - return 'Continue Reading'; + return t('lastRead'); case ScrollerType.LAST_LISTENED: - return 'Continue Listening'; + return t('lastListened'); case ScrollerType.LATEST_ADDED: - return 'Recently Added'; + return t('latestAdded'); case ScrollerType.RANDOM: - return 'Discover Something New'; + return t('random'); default: - return 'Scroller'; + return t('default'); } } diff --git a/booklore-ui/src/app/features/dashboard/components/main-dashboard/main-dashboard.component.html b/booklore-ui/src/app/features/dashboard/components/main-dashboard/main-dashboard.component.html index 1a9165687..f46845100 100644 --- a/booklore-ui/src/app/features/dashboard/components/main-dashboard/main-dashboard.component.html +++ b/booklore-ui/src/app/features/dashboard/components/main-dashboard/main-dashboard.component.html @@ -1,70 +1,72 @@ -
- @if ((bookState$ | async)?.loaded === false) { -
- - -
- } - @if ((bookState$ | async)?.loaded === true) { -
-
- @if (isLibrariesEmpty$ | async) { -
- @if ((userService.userState$ | async)?.user?.permissions; as permissions) { -
- @if (permissions.admin || permissions.canManageLibrary) { -
-

- Welcome to BookLore!
- Let's create your first library -

-

- A library is where all your books live. Start building your digital collection today! -

- - -
- } -
- } -
- } @else { -
- - -
+ +
+ @if ((bookState$ | async)?.loaded === false) { +
+ + +
+ } + @if ((bookState$ | async)?.loaded === true) { +
+
+ @if (isLibrariesEmpty$ | async) { +
+ @if ((userService.userState$ | async)?.user?.permissions; as permissions) { +
+ @if (permissions.admin || permissions.canManageLibrary) { +
+

+ {{ t('welcomeTitle') }}
+ {{ t('welcomeSubtitle') }} +

+

+ {{ t('welcomeDescription') }} +

+ + +
+ } +
+ } +
+ } @else { +
+ + +
- @if (dashboardConfig$ | async; as config) { - @for (scroller of config.scrollers; track scroller.id) { - @if (scroller.enabled) { - - + @if (dashboardConfig$ | async; as config) { + @for (scroller of config.scrollers; track scroller.id) { + @if (scroller.enabled) { + + + } } } } - } +
-
- } -
+ } +
+ diff --git a/booklore-ui/src/app/features/dashboard/components/main-dashboard/main-dashboard.component.ts b/booklore-ui/src/app/features/dashboard/components/main-dashboard/main-dashboard.component.ts index 868cc21c7..2637806d5 100644 --- a/booklore-ui/src/app/features/dashboard/components/main-dashboard/main-dashboard.component.ts +++ b/booklore-ui/src/app/features/dashboard/components/main-dashboard/main-dashboard.component.ts @@ -12,6 +12,7 @@ import {Book, ReadStatus} from '../../../book/model/book.model'; import {UserService} from '../../../settings/user-management/user.service'; import {ProgressSpinner} from 'primeng/progressspinner'; import {TooltipModule} from 'primeng/tooltip'; +import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; import {DashboardConfigService} from '../../services/dashboard-config.service'; import {ScrollerConfig, ScrollerType} from '../../models/dashboard-config.model'; import {MagicShelfService} from '../../../magic-shelf/service/magic-shelf.service'; @@ -33,7 +34,8 @@ const DEFAULT_MAX_ITEMS = 20; DashboardScrollerComponent, AsyncPipe, ProgressSpinner, - TooltipModule + TooltipModule, + TranslocoDirective ], standalone: true }) @@ -47,6 +49,7 @@ export class MainDashboardComponent implements OnInit { private ruleEvaluatorService = inject(BookRuleEvaluatorService); private sortService = inject(SortService); private pageTitle = inject(PageTitleService); + private readonly t = inject(TranslocoService); bookState$ = this.bookService.bookState$; dashboardConfig$ = this.dashboardConfigService.config$; @@ -60,7 +63,7 @@ export class MainDashboardComponent implements OnInit { ScrollerType = ScrollerType; ngOnInit(): void { - this.pageTitle.setPageTitle('Dashboard'); + this.pageTitle.setPageTitle(this.t.translate('dashboard.main.pageTitle')); this.dashboardConfig$.subscribe(() => { this.scrollerBooksCache.clear(); diff --git a/booklore-ui/src/app/features/library-creator/library-creator.component.html b/booklore-ui/src/app/features/library-creator/library-creator.component.html index ad24ee124..c264366fb 100644 --- a/booklore-ui/src/app/features/library-creator/library-creator.component.html +++ b/booklore-ui/src/app/features/library-creator/library-creator.component.html @@ -1,273 +1,275 @@ -
-
-
-
- + +
+
+
+
+ +
+
+

{{ mode === 'edit' ? t('titleEdit') : t('titleNew') }}

+

{{ t('subtitle') }}

+
-
-

{{ mode === 'edit' ? 'Edit Library' : 'New Library' }}

-

Configure your book collection

-
-
- -
+ + -
-
-
- - Library Details -
- -
-
- -
- - @if (chosenLibraryName.trim()) { - - } -
+
+
+
+ + {{ t('libraryDetails') }}
-
- - @if (!selectedIcon) { - - } @else { -
-
- -
- - @if (selectedIcon.type === 'PRIME_NG') { - {{ selectedIcon.value }} - } @else { - Custom SVG - } - - +
+
+ +
+ + @if (chosenLibraryName.trim()) { + + }
- } -
-
-
+
-
-
- - Book Folders - {{ folders.length }} -
- -
- - - @if (folders.length > 0) { -
- @for (folder of folders; track folder; let i = $index) { -
-
- - - {{ folder }} - +
+ + @if (!selectedIcon) { + + } @else { +
+
+
-
}
- } @else { -
- - Add folders containing your book files -
- } -
-
+
+
-
-
- - Options -
- -
-
-
- Watch folders - -
- +
+
+ + {{ t('bookFolders') }} + {{ folders.length }}
-
-
- Metadata source - -
-
+
+ -
- -
-
- Format priority - -
-
- @for (format of formatPriority; track format.type; let i = $index) { -
- {{ i + 1 }} - {{ format.type }} - -
- } -
-
- -
-
- Allowed formats - -
-
- - -
-
- - @if (!allowAllFormats) { -
- @for (format of allBookFormats; track format.type) { -
- - - @if (getFormatWarning(format.type); as warning) { - - } -
- } -
- @if (hasAnyFormatWarning()) { -
+ @if (folders.length > 0) { +
+ @for (folder of folders; track folder; let i = $index) { +
+
+ + + {{ folder }} + +
+ +
+ } +
+ } @else { +
- Deselected formats won't appear in future scans + {{ t('emptyFoldersHint') }}
} +
+
+ +
+
+ + {{ t('options') }} +
+ +
+
+
+ {{ t('watchFolders') }} + +
+ +
+ +
+
+ {{ t('metadataSource') }} + +
+
+ +
+ +
+
+ {{ t('formatPriority') }} + +
+
+ @for (format of formatPriority; track format.type; let i = $index) { +
+ {{ i + 1 }} + {{ format.type }} + +
+ } +
+
+ +
+
+ {{ t('allowedFormats') }} + +
+
+ + +
+
+ + @if (!allowAllFormats) { +
+ @for (format of allBookFormats; track format.type) { +
+ + + @if (getFormatWarning(format.type); as warning) { + + } +
+ } +
+ @if (hasAnyFormatWarning()) { +
+ + {{ t('deselectedFormatsWarning') }} +
+ } + } +
+
+
+ +
+
+ @if (!isLibraryDetailsValid() || !isDirectorySelectionValid()) { +
+ + + @if (!chosenLibraryName.trim()) { + {{ t('validation.enterName') }} + } @else if (!selectedIcon) { + {{ t('validation.selectIcon') }} + } @else { + {{ t('validation.addFolder') }} + } + +
+ } @else { +
+ + {{ mode === 'edit' ? t('validation.readyUpdate') : t('validation.readyCreate') }} +
}
-
+ +
- -
-
- @if (!isLibraryDetailsValid() || !isDirectorySelectionValid()) { -
- - - @if (!chosenLibraryName.trim()) { - Enter library name - } @else if (!selectedIcon) { - Select an icon - } @else { - Add at least one folder - } - -
- } @else { -
- - Ready to {{ mode === 'edit' ? 'update' : 'create' }} -
- } -
- -
-
+ diff --git a/booklore-ui/src/app/features/library-creator/library-creator.component.ts b/booklore-ui/src/app/features/library-creator/library-creator.component.ts index ca0d785f1..f33e76b9b 100644 --- a/booklore-ui/src/app/features/library-creator/library-creator.component.ts +++ b/booklore-ui/src/app/features/library-creator/library-creator.component.ts @@ -18,12 +18,13 @@ import {map} from 'rxjs'; import {CdkDragDrop, DragDropModule, moveItemInArray} from '@angular/cdk/drag-drop'; import {Checkbox} from 'primeng/checkbox'; import {Select} from 'primeng/select'; +import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco'; @Component({ selector: 'app-library-creator', standalone: true, templateUrl: './library-creator.component.html', - imports: [FormsModule, InputText, ToggleSwitch, Tooltip, Button, IconDisplayComponent, DragDropModule, Checkbox, Select], + imports: [FormsModule, InputText, ToggleSwitch, Tooltip, Button, IconDisplayComponent, DragDropModule, Checkbox, Select, TranslocoDirective, TranslocoPipe], styleUrl: './library-creator.component.scss' }) export class LibraryCreatorComponent implements OnInit { @@ -41,13 +42,7 @@ export class LibraryCreatorComponent implements OnInit { formatCounts: Record = {}; metadataSource: MetadataSource = 'EMBEDDED'; - readonly metadataSourceOptions = [ - {label: 'Embedded Only', value: 'EMBEDDED', description: 'Use only embedded file metadata'}, - {label: 'Sidecar Only', value: 'SIDECAR', description: 'Use only sidecar JSON files'}, - {label: 'Prefer Sidecar', value: 'PREFER_SIDECAR', description: 'Use sidecar if available, fallback to embedded'}, - {label: 'Prefer Embedded', value: 'PREFER_EMBEDDED', description: 'Use embedded if available, fallback to sidecar'}, - {label: 'None', value: 'NONE', description: 'Don\'t read metadata from files'} - ]; + metadataSourceOptions: {label: string, value: string}[] = []; readonly allBookFormats: {type: BookType, label: string}[] = [ {type: 'EPUB', label: 'EPUB'}, @@ -66,8 +61,16 @@ export class LibraryCreatorComponent implements OnInit { private messageService = inject(MessageService); private router = inject(Router); private iconPicker = inject(IconPickerService); + private readonly t = inject(TranslocoService); ngOnInit(): void { + this.metadataSourceOptions = [ + {label: this.t.translate('libraryCreator.creator.metadataSourceEmbedded'), value: 'EMBEDDED'}, + {label: this.t.translate('libraryCreator.creator.metadataSourceSidecar'), value: 'SIDECAR'}, + {label: this.t.translate('libraryCreator.creator.metadataSourcePreferSidecar'), value: 'PREFER_SIDECAR'}, + {label: this.t.translate('libraryCreator.creator.metadataSourcePreferEmbedded'), value: 'PREFER_EMBEDDED'}, + {label: this.t.translate('libraryCreator.creator.metadataSourceNone'), value: 'NONE'} + ]; this.initializeFormatPriority(); this.initializeAllowedFormats(); @@ -154,7 +157,7 @@ export class LibraryCreatorComponent implements OnInit { if (this.mode !== 'edit') return null; const count = this.formatCounts[formatType]; if (count && count > 0 && !this.selectedAllowedFormats.has(formatType)) { - return `${count} existing book${count > 1 ? 's' : ''} will not appear in future scans`; + return this.t.translate('libraryCreator.creator.formatWarning', {count}); } return null; } @@ -216,8 +219,8 @@ export class LibraryCreatorComponent implements OnInit { if (exists) { this.messageService.add({ severity: 'error', - summary: 'Library Name Exists', - detail: 'This library name is already taken.', + summary: this.t.translate('libraryCreator.creator.toast.nameExistsSummary'), + detail: this.t.translate('libraryCreator.creator.toast.nameExistsDetail'), }); return; } @@ -240,11 +243,11 @@ export class LibraryCreatorComponent implements OnInit { if (this.mode === 'edit') { this.libraryService.updateLibrary(library, this.library?.id).subscribe({ next: () => { - this.messageService.add({severity: 'success', summary: 'Library Updated', detail: 'The library was updated successfully.'}); + this.messageService.add({severity: 'success', summary: this.t.translate('libraryCreator.creator.toast.updatedSummary'), detail: this.t.translate('libraryCreator.creator.toast.updatedDetail')}); this.dynamicDialogRef.close(); }, error: (e) => { - this.messageService.add({severity: 'error', summary: 'Update Failed', detail: 'An error occurred while updating the library. Please try again.'}); + this.messageService.add({severity: 'error', summary: this.t.translate('libraryCreator.creator.toast.updateFailedSummary'), detail: this.t.translate('libraryCreator.creator.toast.updateFailedDetail')}); console.error(e); } }); @@ -269,17 +272,17 @@ export class LibraryCreatorComponent implements OnInit { this.router.navigate(['/library', createdLibrary.id, 'books']); this.messageService.add({ severity: 'success', - summary: 'Library Created', + summary: this.t.translate('libraryCreator.creator.toast.createdSummary'), detail: count >= 500 - ? `Library created with ${count} files. Loading in progress...` - : 'The library was created successfully.' + ? this.t.translate('libraryCreator.creator.toast.createdLargeDetail', {count}) + : this.t.translate('libraryCreator.creator.toast.createdDetail') }); this.dynamicDialogRef.close(); } }, error: (e) => { this.libraryService.setLargeLibraryLoading(false, 0); - this.messageService.add({severity: 'error', summary: 'Creation Failed', detail: 'An error occurred while creating the library. Please try again.'}); + this.messageService.add({severity: 'error', summary: this.t.translate('libraryCreator.creator.toast.createFailedSummary'), detail: this.t.translate('libraryCreator.creator.toast.createFailedDetail')}); console.error(e); } }); diff --git a/booklore-ui/src/app/features/library-creator/library-loading/library-loading.component.html b/booklore-ui/src/app/features/library-creator/library-loading/library-loading.component.html index 1f552bf46..f4002c2ae 100644 --- a/booklore-ui/src/app/features/library-creator/library-loading/library-loading.component.html +++ b/booklore-ui/src/app/features/library-creator/library-loading/library-loading.component.html @@ -1,50 +1,52 @@ -
-
-
- -

Loading Library

-
+ +
+
+
+ +

{{ t('title') }}

+
+ +
+
+ @if (!isComplete) { + + {{ t('processing') }} {{ truncatedTitle }} + + } + @if (isComplete) { + + + {{ t('complete') }} + + } +
+ +
+ {{ current }} / {{ total }} + {{ percentage }}% +
+ +
+
+
-
-
@if (!isComplete) { - - Processing: {{ truncatedTitle }} - - } - @if (isComplete) { - - - Library Loading Complete! - +
+
+
+
+
}
-
- {{ current }} / {{ total }} - {{ percentage }}% -
- -
-
-
- - @if (!isComplete) { -
-
-
-
+ @if (isComplete) { + }
- - @if (isComplete) { - - }
-
+ diff --git a/booklore-ui/src/app/features/library-creator/library-loading/library-loading.component.ts b/booklore-ui/src/app/features/library-creator/library-loading/library-loading.component.ts index fcaf5fb62..4522e1dbc 100644 --- a/booklore-ui/src/app/features/library-creator/library-loading/library-loading.component.ts +++ b/booklore-ui/src/app/features/library-creator/library-loading/library-loading.component.ts @@ -1,10 +1,11 @@ import { Component } from '@angular/core'; import { CommonModule } from '@angular/common'; +import {TranslocoDirective} from '@jsverse/transloco'; @Component({ selector: 'app-library-loading', standalone: true, - imports: [CommonModule], + imports: [CommonModule, TranslocoDirective], templateUrl: './library-loading.component.html', styleUrl: './library-loading.component.scss' }) diff --git a/booklore-ui/src/app/features/metadata/component/book-metadata-center/book-metadata-center.component.html b/booklore-ui/src/app/features/metadata/component/book-metadata-center/book-metadata-center.component.html index 5de6cd04a..812056c97 100644 --- a/booklore-ui/src/app/features/metadata/component/book-metadata-center/book-metadata-center.component.html +++ b/booklore-ui/src/app/features/metadata/component/book-metadata-center/book-metadata-center.component.html @@ -1,12 +1,12 @@ -