feat: add i18n translations for stats, pdf reader, magic shelf, and remaining components (en/es) (#2742)
This commit is contained in:
+11
-11
@@ -1,3 +1,4 @@
|
||||
<ng-container *transloco="let t; prefix: 'shared.metadataProgress'">
|
||||
<div class="task-border">
|
||||
@if (Object.keys(activeTasks).length > 0) {
|
||||
@for (task of activeTasks | keyvalue; track task; let idx = $index) {
|
||||
@@ -5,18 +6,18 @@
|
||||
|
||||
<div class="task-header-row">
|
||||
<div class="task-title-group">
|
||||
<p class="task-title">Metadata Fetch Task</p>
|
||||
<p class="task-title">{{ t('taskTitle') }}</p>
|
||||
</div>
|
||||
<div class="task-tags">
|
||||
@if (task.value.review) {
|
||||
<p-tag
|
||||
value="Review"
|
||||
[value]="t('tagReview')"
|
||||
severity="warn"
|
||||
class="task-tag">
|
||||
</p-tag>
|
||||
} @else {
|
||||
<p-tag
|
||||
value="Auto"
|
||||
[value]="t('tagAuto')"
|
||||
severity="success"
|
||||
class="task-tag">
|
||||
</p-tag>
|
||||
@@ -33,9 +34,7 @@
|
||||
{{ task.value.message }}
|
||||
</div>
|
||||
|
||||
<div class="task-progress-info">
|
||||
Book <strong>{{ task.value.status === 'COMPLETED' || task.value.completed >= task.value.total ? task.value.total : task.value.completed + 1 }}</strong>
|
||||
of {{ task.value.total }}
|
||||
<div class="task-progress-info" [innerHTML]="t('bookProgress', { current: task.value.status === 'COMPLETED' || task.value.completed >= task.value.total ? task.value.total : task.value.completed + 1, total: task.value.total })">
|
||||
</div>
|
||||
|
||||
<p-progressBar
|
||||
@@ -48,7 +47,7 @@
|
||||
<div class="action-buttons">
|
||||
@if (task.value.review) {
|
||||
<p-button
|
||||
label="Review"
|
||||
[label]="t('reviewBtn')"
|
||||
severity="info"
|
||||
icon="pi pi-search"
|
||||
size="small"
|
||||
@@ -58,11 +57,11 @@
|
||||
}
|
||||
|
||||
<p-button
|
||||
[label]="task.value.review ? 'Discard' : 'Dismiss'"
|
||||
[label]="task.value.review ? t('discardBtn') : t('dismissBtn')"
|
||||
icon="pi pi-times"
|
||||
[severity]="task.value.review ? 'danger' : 'secondary'"
|
||||
size="small"
|
||||
[pTooltip]="task.value.review ? 'Preserve current metadata, discard new fetched metadata' : ''"
|
||||
[pTooltip]="task.value.review ? t('discardTooltip') : ''"
|
||||
[tooltipPosition]="task.value.review ? 'top' : undefined"
|
||||
outlined
|
||||
(click)="clearTask(task.key)">
|
||||
@@ -71,11 +70,11 @@
|
||||
} @else if (task.value.status === 'IN_PROGRESS') {
|
||||
<div class="action-buttons">
|
||||
<p-button
|
||||
label="Cancel"
|
||||
[label]="t('cancelBtn')"
|
||||
icon="pi pi-stop"
|
||||
severity="danger"
|
||||
size="small"
|
||||
pTooltip="Cancel this task"
|
||||
[pTooltip]="t('cancelTooltip')"
|
||||
tooltipPosition="top"
|
||||
outlined
|
||||
(click)="cancelTask(task.key)">
|
||||
@@ -91,3 +90,4 @@
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+12
-4
@@ -7,9 +7,9 @@ import {ButtonModule} from 'primeng/button';
|
||||
import {Divider} from 'primeng/divider';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {TranslocoService} from '@jsverse/transloco';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
import {MetadataBatchProgressNotification, MetadataBatchStatus, MetadataBatchStatusLabels} from '../../model/metadata-batch-progress.model';
|
||||
import {MetadataBatchProgressNotification, MetadataBatchStatus} from '../../model/metadata-batch-progress.model';
|
||||
import {MetadataProgressService} from '../../service/metadata-progress.service';
|
||||
import {MetadataTaskService} from '../../../features/book/service/metadata-task';
|
||||
import {Tag} from 'primeng/tag';
|
||||
@@ -21,7 +21,7 @@ import {DialogLauncherService} from '../../services/dialog-launcher.service';
|
||||
templateUrl: './metadata-progress-widget-component.html',
|
||||
styleUrls: ['./metadata-progress-widget-component.scss'],
|
||||
standalone: true,
|
||||
imports: [KeyValuePipe, ProgressBarModule, ButtonModule, Divider, Tooltip, Tag]
|
||||
imports: [KeyValuePipe, ProgressBarModule, ButtonModule, Divider, Tooltip, Tag, TranslocoDirective]
|
||||
})
|
||||
export class MetadataProgressWidgetComponent implements OnInit, OnDestroy {
|
||||
activeTasks: Record<string, MetadataBatchProgressNotification> = {};
|
||||
@@ -160,8 +160,16 @@ export class MetadataProgressWidgetComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
private readonly statusLabelKeys: Record<MetadataBatchStatus, string> = {
|
||||
[MetadataBatchStatus.IN_PROGRESS]: 'shared.metadataProgress.statusInProgress',
|
||||
[MetadataBatchStatus.COMPLETED]: 'shared.metadataProgress.statusCompleted',
|
||||
[MetadataBatchStatus.ERROR]: 'shared.metadataProgress.statusError',
|
||||
[MetadataBatchStatus.CANCELLED]: 'shared.metadataProgress.statusCancelled',
|
||||
};
|
||||
|
||||
getStatusLabel(status: MetadataBatchStatus): string {
|
||||
return MetadataBatchStatusLabels[status] ?? status;
|
||||
const key = this.statusLabelKeys[status];
|
||||
return key ? this.t.translate(key) : status;
|
||||
}
|
||||
|
||||
protected readonly Object = Object;
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
[ngStyle]="{ color: iconColor }"
|
||||
style="font-size: 1.25rem"
|
||||
[class.pulsating]="iconPulsating"
|
||||
aria-label="Unified Notification Icon"
|
||||
[attr.aria-label]="t('notificationAriaLabel')"
|
||||
></i>
|
||||
</button>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user