Translation rework: file status, other fixes

This commit is contained in:
Adina Țeudan 2021-07-22 16:43:10 +03:00
parent 297f55493c
commit 585e2d69d4
11 changed files with 62 additions and 28 deletions

View File

@ -10,6 +10,7 @@ import { User } from '@redaction/red-ui-http';
import { Toaster } from '@services/toaster.service';
import { FilterService } from '@shared/services/filter.service';
import { DossierAttributeWithValue } from '@models/dossier-attributes.model';
import { fileStatusTranslations } from '../../translations/file-status-translations';
@Component({
selector: 'redaction-dossier-details',
@ -68,7 +69,7 @@ export class DossierDetailsComponent implements OnInit {
this.documentsChartData.push({
value: groups[key].length,
color: key,
label: key,
label: fileStatusTranslations[key],
key: key
});
}

View File

@ -30,6 +30,8 @@ import { BaseListingComponent } from '@shared/base/base-listing.component';
import { SortingService } from '@services/sorting.service';
import { TableColConfig } from '@shared/components/table-col-name/table-col-name.component';
import { workloadTranslations } from '../../translations/workload-translations';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { fileStatusTranslations } from '../../translations/file-status-translations';
const isLeavingScreen = event => event instanceof NavigationStart && event.url !== '/main/dossiers';
@ -159,8 +161,8 @@ export class DossierListingScreenComponent
this._computeAllFilters();
this.dossiersChartData = [
{ value: this._activeDossiersCount, color: 'ACTIVE', label: 'active' },
{ value: this._inactiveDossiersCount, color: 'DELETED', label: 'archived' }
{ value: this._activeDossiersCount, color: 'ACTIVE', label: _('active') },
{ value: this._inactiveDossiersCount, color: 'DELETED', label: _('archived') }
];
const groups = groupBy(this._appStateService.aggregatedFiles, 'status');
this.documentsChartData = [];
@ -169,7 +171,7 @@ export class DossierListingScreenComponent
this.documentsChartData.push({
value: groups[key].length,
color: key,
label: key,
label: fileStatusTranslations[key],
key: key
});
}
@ -205,7 +207,7 @@ export class DossierListingScreenComponent
const statusFilters = [...allDistinctFileStatus].map<FilterModel>(status => ({
key: status,
label: this._translateService.instant(status)
label: this._translateService.instant(fileStatusTranslations[status])
}));
this.filterService.addFilterGroup({

View File

@ -33,6 +33,7 @@ import { DossierAttributesService } from '@shared/services/controller-wrappers/d
import { DossierAttributeWithValue } from '@models/dossier-attributes.model';
import { UserPreferenceService } from '@services/user-preference.service';
import { workloadTranslations } from '../../translations/workload-translations';
import { fileStatusTranslations } from '../../translations/file-status-translations';
@Component({
templateUrl: './dossier-overview-screen.component.html',
@ -259,7 +260,7 @@ export class DossierOverviewScreenComponent
const statusFilters = [...allDistinctFileStatusWrapper].map<FilterModel>(item => ({
key: item,
label: this._translateService.instant(item)
label: this._translateService.instant(fileStatusTranslations[item])
}));
this.filterService.addFilterGroup({

View File

@ -35,7 +35,7 @@
<redaction-status-bar [config]="statusBarConfig" [small]="true"></redaction-status-bar>
<div class="all-caps-label mr-16 ml-8">
{{ status | translate }}
{{ translations[status] | translate }}
<span *ngIf="isUnderReviewOrApproval">{{ 'by' | translate }}:</span>
</div>
</ng-container>

View File

@ -37,6 +37,7 @@ import { LoadingService } from '@services/loading.service';
import { stampPDFPage } from '../../../../utils/page-stamper';
import { TranslateService } from '@ngx-translate/core';
import { AutoUnsubscribeComponent } from '@shared/base/auto-unsubscribe.component';
import { fileStatusTranslations } from '../../translations/file-status-translations';
const ALL_HOTKEY_ARRAY = ['Escape', 'F', 'f'];
@ -64,10 +65,10 @@ export class FilePreviewScreenComponent extends AutoUnsubscribeComponent impleme
viewDocumentInfo = false;
excludePages = false;
@ViewChild(PdfViewerComponent) viewerComponent: PdfViewerComponent;
translations = fileStatusTranslations;
private _instance: WebViewerInstance;
private _lastPage: string;
private _reloadFileOnReanalysis = false;
@ViewChild('fileWorkloadComponent') private _workloadComponent: FileWorkloadComponent;
constructor(

View File

@ -205,7 +205,7 @@ export class DossiersDialogService extends DialogService<DialogType> {
title: _('confirmation-dialog.delete-dossier.title'),
titleColor: TitleColors.PRIMARY,
question: _('confirmation-dialog.delete-dossier.question'),
// details: _('confirmation-dialog.delete-dossier.details'),
details: _('confirmation-dialog.delete-dossier.details'),
confirmationText: _('confirmation-dialog.delete-dossier.confirmation-text'),
requireInput: true,
denyText: _('confirmation-dialog.delete-dossier.deny-text'),

View File

@ -0,0 +1,16 @@
import { FileStatus } from '@redaction/red-ui-http';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
export const fileStatusTranslations: { [key in FileStatus.StatusEnum]: string } = {
APPROVED: _('file-status.approved'),
ERROR: _('file-status.error'),
EXCLUDED: _('file-status.excluded'),
FULLREPROCESS: _('file-status.full-reprocess'),
OCR_PROCESSING: _('file-status.ocr-processing'),
PROCESSING: _('file-status.processing'),
REPROCESS: _('file-status.reprocess'),
UNASSIGNED: _('file-status.unassigned'),
UNDER_APPROVAL: _('file-status.under-approval'),
UNDER_REVIEW: _('file-status.under-review'),
UNPROCESSED: _('file-status.unprocessed')
};

View File

@ -40,7 +40,6 @@ export class ConfirmationDialogComponent {
config: ConfirmationDialogInput;
inputValue = '';
readonly inputLabel: string;
private readonly _inputLabelKey = 'confirmation-dialog.delete-dossier.input-label';
constructor(
private readonly _dialogRef: MatDialogRef<ConfirmationDialogComponent>,
@ -49,7 +48,7 @@ export class ConfirmationDialogComponent {
) {
this.config = _confirmationDialogInput ?? new ConfirmationDialogInput();
this.config = this.translate(this.config);
this.inputLabel = this.translate(this._inputLabelKey) + ` '${this.config.confirmationText}'`;
this.inputLabel = this.translate('confirmation-dialog.delete-dossier.input-label') + ` '${this.config.confirmationText}'`;
}
get isDeleteAction() {

View File

@ -7,8 +7,6 @@ import { rolesTranslations } from '../translations/roles-translations';
providedIn: 'root'
})
export class TranslateChartService {
translations = rolesTranslations;
constructor(private readonly _translateService: TranslateService) {}
translateStatus(config: DoughnutChartConfig[]): DoughnutChartConfig[] {
@ -18,7 +16,7 @@ export class TranslateChartService {
translateRoles(config: DoughnutChartConfig[]): DoughnutChartConfig[] {
return config.map(val => ({
...val,
label: this._translateService.instant(this.translations[val.label]).toLowerCase()
label: this._translateService.instant(rolesTranslations[val.label]).toLowerCase()
}));
}
}

View File

@ -233,8 +233,6 @@
"suggestion-remove-dictionary": "Suggested dictionary removal"
},
"annotations": "Annotations",
"app-name": "DDA-R",
"APPROVED": "Approved",
"archived": "Archived",
"assign-dossier-owner": {
"dialog": {
@ -318,7 +316,6 @@
"comment": "Comment",
"comments": {
"add-comment": "Enter comment",
"cancel": "Cancel",
"comments": "{count} {count, plural, one{comment} other{comments}}",
"hide-comments": "Hide comments"
},
@ -807,8 +804,6 @@
"unsaved-changes": "You have unsaved changes. Save or revert before changing the tab."
},
"efsa": "EFSA Approval",
"ERROR": "Re-processing required",
"EXCLUDED": "Excluded",
"file-attribute-types": {
"date": "Date",
"number": "Number",
@ -969,6 +964,19 @@
},
"unassigned": "Unassigned"
},
"file-status": {
"approved": "Approved",
"error": "Re-processing required",
"excluded": "Excluded",
"full-reprocess": "Processing",
"ocr-processing": "OCR Processing",
"processing": "Processing",
"reprocess": "Processing",
"unassigned": "Unassigned",
"under-approval": "Under Approval",
"under-review": "Under Review",
"unprocessed": "Unprocessed"
},
"filter": {
"analysis": "Analysis required",
"hint": "Hints only",
@ -995,7 +1003,6 @@
"status": "Status"
},
"finished": "Finished",
"FULLREPROCESS": "Processing",
"hint": "Hint",
"initials-avatar": {
"unassigned": "Unassigned",
@ -1072,7 +1079,6 @@
"tomorrow": "Tomorrow",
"yesterday": "Yesterday"
},
"OCR_PROCESSING": "OCR Processing",
"overwrite-files-dialog": {
"options": {
"cancel": "Cancel all uploads",
@ -1097,7 +1103,6 @@
},
"pending-analysis": "Pending Re-Analysis",
"pending-changes-guard": "WARNING: You have unsaved changes. Press Cancel to go back and save these changes, or OK to lose these changes.",
"PROCESSING": "Processing",
"readonly": "Read only",
"recategorize-image-dialog": {
"actions": {
@ -1149,7 +1154,6 @@
"title": "Reports",
"upload-document": "Upload a Document"
},
"REPROCESS": "Processing",
"reset-filters": "Reset Filters",
"reset-password-dialog": {
"actions": {
@ -1239,8 +1243,8 @@
"submitted": "Submitted",
"suggestion": "Suggestion for redaction",
"time": {
"hours": "{hours} {hours, plural, one{hour} other{hours}}",
"days": "{days} {days, plural, one{day} other{days}}",
"hours": "{hours} {hours, plural, one{hour} other{hours}}",
"less-than-an-hour": "< 1 hour",
"no-time-left": "Time to restore already passed"
},
@ -1293,10 +1297,6 @@
}
},
"type": "Type",
"UNASSIGNED": "Unassigned",
"UNDER_APPROVAL": "Under Approval",
"UNDER_REVIEW": "Under Review",
"UNPROCESSED": "Unprocessed",
"upload-status": {
"dialog": {
"actions": {

View File

@ -4,6 +4,7 @@
"all": "",
"none": ""
},
"active": "",
"add-dossier-dialog": {
"actions": {
"save": "",
@ -230,6 +231,7 @@
"suggestion-remove-dictionary": ""
},
"annotations": "",
"archived": "",
"assign-dossier-owner": {
"dialog": {
"approvers": "",
@ -349,6 +351,7 @@
"delete-dossier": {
"confirmation-text": "",
"deny-text": "",
"details": "",
"question": "",
"title": ""
},
@ -885,6 +888,19 @@
}
}
},
"file-status": {
"approved": "",
"error": "",
"excluded": "",
"full-reprocess": "",
"ocr-processing": "",
"processing": "",
"reprocess": "",
"unassigned": "",
"under-approval": "",
"under-review": "",
"unprocessed": ""
},
"filter-menu": {
"filter-options": "",
"filter-types": "",