feat(i18n): add Transloco translation framework with EN/ES and 7 language scaffolds (#2681)
* feat(i18n): add Transloco translation framework and translate all settings tabs (EN/ES) * feat(i18n): translate shared, layout, dashboard, library-creator, and app-root components (EN/ES) and scaffold 7 new languages * feat(i18n): translate bookdrop and metadata components (EN/ES), remove i18n-audit from tracking * fix(i18n): deep-merge English as fallback base for incomplete language translations
This commit is contained in:
+10
-6
@@ -12,6 +12,7 @@ import {filter, take} from 'rxjs/operators';
|
||||
import {InputText} from 'primeng/inputtext';
|
||||
import {Slider} from 'primeng/slider';
|
||||
import {ExternalDocLinkComponent} from '../../../shared/components/external-doc-link/external-doc-link.component';
|
||||
import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
@Component({
|
||||
selector: 'app-global-preferences',
|
||||
@@ -22,7 +23,9 @@ import {ExternalDocLinkComponent} from '../../../shared/components/external-doc-
|
||||
FormsModule,
|
||||
InputText,
|
||||
Slider,
|
||||
ExternalDocLinkComponent
|
||||
ExternalDocLinkComponent,
|
||||
TranslocoDirective,
|
||||
TranslocoPipe
|
||||
],
|
||||
templateUrl: './global-preferences.component.html',
|
||||
styleUrl: './global-preferences.component.scss'
|
||||
@@ -45,6 +48,7 @@ export class GlobalPreferencesComponent implements OnInit {
|
||||
private appSettingsService = inject(AppSettingsService);
|
||||
private bookService = inject(BookService);
|
||||
private messageService = inject(MessageService);
|
||||
private t = inject(TranslocoService);
|
||||
|
||||
appSettings$: Observable<AppSettings | null> = this.appSettingsService.appSettings$;
|
||||
maxFileUploadSizeInMb?: number;
|
||||
@@ -87,7 +91,7 @@ export class GlobalPreferencesComponent implements OnInit {
|
||||
|
||||
saveFileSize() {
|
||||
if (!this.maxFileUploadSizeInMb || this.maxFileUploadSizeInMb <= 0) {
|
||||
this.showMessage('error', 'Invalid Input', 'Please enter a valid max file upload size in MB.');
|
||||
this.showMessage('error', this.t.translate('settingsApp.fileManagement.invalidInput'), this.t.translate('settingsApp.fileManagement.invalidInputDetail'));
|
||||
return;
|
||||
}
|
||||
this.saveSetting(AppSettingKey.MAX_FILE_UPLOAD_SIZE_IN_MB, this.maxFileUploadSizeInMb);
|
||||
@@ -96,18 +100,18 @@ export class GlobalPreferencesComponent implements OnInit {
|
||||
regenerateCovers(): void {
|
||||
this.bookService.regenerateCovers().subscribe({
|
||||
next: () =>
|
||||
this.showMessage('success', 'Cover Regeneration Started', 'Book covers are being regenerated.'),
|
||||
this.showMessage('success', this.t.translate('settingsApp.covers.regenerateStarted'), this.t.translate('settingsApp.covers.regenerateStartedDetail')),
|
||||
error: () =>
|
||||
this.showMessage('error', 'Error', 'Failed to start cover regeneration.')
|
||||
this.showMessage('error', this.t.translate('common.error'), this.t.translate('settingsApp.covers.regenerateError'))
|
||||
});
|
||||
}
|
||||
|
||||
private saveSetting(key: string, value: unknown): void {
|
||||
this.appSettingsService.saveSettings([{key, newValue: value}]).subscribe({
|
||||
next: () =>
|
||||
this.showMessage('success', 'Settings Saved', 'The settings were successfully saved!'),
|
||||
this.showMessage('success', this.t.translate('settingsApp.settingsSaved'), this.t.translate('settingsApp.settingsSavedDetail')),
|
||||
error: () =>
|
||||
this.showMessage('error', 'Error', 'There was an error saving the settings.')
|
||||
this.showMessage('error', this.t.translate('common.error'), this.t.translate('settingsApp.settingsError'))
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user