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

View File

@ -30,6 +30,8 @@ import { BaseListingComponent } from '@shared/base/base-listing.component';
import { SortingService } from '@services/sorting.service'; import { SortingService } from '@services/sorting.service';
import { TableColConfig } from '@shared/components/table-col-name/table-col-name.component'; import { TableColConfig } from '@shared/components/table-col-name/table-col-name.component';
import { workloadTranslations } from '../../translations/workload-translations'; 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'; const isLeavingScreen = event => event instanceof NavigationStart && event.url !== '/main/dossiers';
@ -159,8 +161,8 @@ export class DossierListingScreenComponent
this._computeAllFilters(); this._computeAllFilters();
this.dossiersChartData = [ this.dossiersChartData = [
{ value: this._activeDossiersCount, color: 'ACTIVE', label: 'active' }, { value: this._activeDossiersCount, color: 'ACTIVE', label: _('active') },
{ value: this._inactiveDossiersCount, color: 'DELETED', label: 'archived' } { value: this._inactiveDossiersCount, color: 'DELETED', label: _('archived') }
]; ];
const groups = groupBy(this._appStateService.aggregatedFiles, 'status'); const groups = groupBy(this._appStateService.aggregatedFiles, 'status');
this.documentsChartData = []; this.documentsChartData = [];
@ -169,7 +171,7 @@ export class DossierListingScreenComponent
this.documentsChartData.push({ this.documentsChartData.push({
value: groups[key].length, value: groups[key].length,
color: key, color: key,
label: key, label: fileStatusTranslations[key],
key: key key: key
}); });
} }
@ -205,7 +207,7 @@ export class DossierListingScreenComponent
const statusFilters = [...allDistinctFileStatus].map<FilterModel>(status => ({ const statusFilters = [...allDistinctFileStatus].map<FilterModel>(status => ({
key: status, key: status,
label: this._translateService.instant(status) label: this._translateService.instant(fileStatusTranslations[status])
})); }));
this.filterService.addFilterGroup({ 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 { DossierAttributeWithValue } from '@models/dossier-attributes.model';
import { UserPreferenceService } from '@services/user-preference.service'; import { UserPreferenceService } from '@services/user-preference.service';
import { workloadTranslations } from '../../translations/workload-translations'; import { workloadTranslations } from '../../translations/workload-translations';
import { fileStatusTranslations } from '../../translations/file-status-translations';
@Component({ @Component({
templateUrl: './dossier-overview-screen.component.html', templateUrl: './dossier-overview-screen.component.html',
@ -259,7 +260,7 @@ export class DossierOverviewScreenComponent
const statusFilters = [...allDistinctFileStatusWrapper].map<FilterModel>(item => ({ const statusFilters = [...allDistinctFileStatusWrapper].map<FilterModel>(item => ({
key: item, key: item,
label: this._translateService.instant(item) label: this._translateService.instant(fileStatusTranslations[item])
})); }));
this.filterService.addFilterGroup({ this.filterService.addFilterGroup({

View File

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

View File

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

View File

@ -205,7 +205,7 @@ export class DossiersDialogService extends DialogService<DialogType> {
title: _('confirmation-dialog.delete-dossier.title'), title: _('confirmation-dialog.delete-dossier.title'),
titleColor: TitleColors.PRIMARY, titleColor: TitleColors.PRIMARY,
question: _('confirmation-dialog.delete-dossier.question'), 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'), confirmationText: _('confirmation-dialog.delete-dossier.confirmation-text'),
requireInput: true, requireInput: true,
denyText: _('confirmation-dialog.delete-dossier.deny-text'), 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; config: ConfirmationDialogInput;
inputValue = ''; inputValue = '';
readonly inputLabel: string; readonly inputLabel: string;
private readonly _inputLabelKey = 'confirmation-dialog.delete-dossier.input-label';
constructor( constructor(
private readonly _dialogRef: MatDialogRef<ConfirmationDialogComponent>, private readonly _dialogRef: MatDialogRef<ConfirmationDialogComponent>,
@ -49,7 +48,7 @@ export class ConfirmationDialogComponent {
) { ) {
this.config = _confirmationDialogInput ?? new ConfirmationDialogInput(); this.config = _confirmationDialogInput ?? new ConfirmationDialogInput();
this.config = this.translate(this.config); 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() { get isDeleteAction() {

View File

@ -7,8 +7,6 @@ import { rolesTranslations } from '../translations/roles-translations';
providedIn: 'root' providedIn: 'root'
}) })
export class TranslateChartService { export class TranslateChartService {
translations = rolesTranslations;
constructor(private readonly _translateService: TranslateService) {} constructor(private readonly _translateService: TranslateService) {}
translateStatus(config: DoughnutChartConfig[]): DoughnutChartConfig[] { translateStatus(config: DoughnutChartConfig[]): DoughnutChartConfig[] {
@ -18,7 +16,7 @@ export class TranslateChartService {
translateRoles(config: DoughnutChartConfig[]): DoughnutChartConfig[] { translateRoles(config: DoughnutChartConfig[]): DoughnutChartConfig[] {
return config.map(val => ({ return config.map(val => ({
...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" "suggestion-remove-dictionary": "Suggested dictionary removal"
}, },
"annotations": "Annotations", "annotations": "Annotations",
"app-name": "DDA-R",
"APPROVED": "Approved",
"archived": "Archived", "archived": "Archived",
"assign-dossier-owner": { "assign-dossier-owner": {
"dialog": { "dialog": {
@ -318,7 +316,6 @@
"comment": "Comment", "comment": "Comment",
"comments": { "comments": {
"add-comment": "Enter comment", "add-comment": "Enter comment",
"cancel": "Cancel",
"comments": "{count} {count, plural, one{comment} other{comments}}", "comments": "{count} {count, plural, one{comment} other{comments}}",
"hide-comments": "Hide comments" "hide-comments": "Hide comments"
}, },
@ -807,8 +804,6 @@
"unsaved-changes": "You have unsaved changes. Save or revert before changing the tab." "unsaved-changes": "You have unsaved changes. Save or revert before changing the tab."
}, },
"efsa": "EFSA Approval", "efsa": "EFSA Approval",
"ERROR": "Re-processing required",
"EXCLUDED": "Excluded",
"file-attribute-types": { "file-attribute-types": {
"date": "Date", "date": "Date",
"number": "Number", "number": "Number",
@ -969,6 +964,19 @@
}, },
"unassigned": "Unassigned" "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": { "filter": {
"analysis": "Analysis required", "analysis": "Analysis required",
"hint": "Hints only", "hint": "Hints only",
@ -995,7 +1003,6 @@
"status": "Status" "status": "Status"
}, },
"finished": "Finished", "finished": "Finished",
"FULLREPROCESS": "Processing",
"hint": "Hint", "hint": "Hint",
"initials-avatar": { "initials-avatar": {
"unassigned": "Unassigned", "unassigned": "Unassigned",
@ -1072,7 +1079,6 @@
"tomorrow": "Tomorrow", "tomorrow": "Tomorrow",
"yesterday": "Yesterday" "yesterday": "Yesterday"
}, },
"OCR_PROCESSING": "OCR Processing",
"overwrite-files-dialog": { "overwrite-files-dialog": {
"options": { "options": {
"cancel": "Cancel all uploads", "cancel": "Cancel all uploads",
@ -1097,7 +1103,6 @@
}, },
"pending-analysis": "Pending Re-Analysis", "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.", "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", "readonly": "Read only",
"recategorize-image-dialog": { "recategorize-image-dialog": {
"actions": { "actions": {
@ -1149,7 +1154,6 @@
"title": "Reports", "title": "Reports",
"upload-document": "Upload a Document" "upload-document": "Upload a Document"
}, },
"REPROCESS": "Processing",
"reset-filters": "Reset Filters", "reset-filters": "Reset Filters",
"reset-password-dialog": { "reset-password-dialog": {
"actions": { "actions": {
@ -1239,8 +1243,8 @@
"submitted": "Submitted", "submitted": "Submitted",
"suggestion": "Suggestion for redaction", "suggestion": "Suggestion for redaction",
"time": { "time": {
"hours": "{hours} {hours, plural, one{hour} other{hours}}",
"days": "{days} {days, plural, one{day} other{days}}", "days": "{days} {days, plural, one{day} other{days}}",
"hours": "{hours} {hours, plural, one{hour} other{hours}}",
"less-than-an-hour": "< 1 hour", "less-than-an-hour": "< 1 hour",
"no-time-left": "Time to restore already passed" "no-time-left": "Time to restore already passed"
}, },
@ -1293,10 +1297,6 @@
} }
}, },
"type": "Type", "type": "Type",
"UNASSIGNED": "Unassigned",
"UNDER_APPROVAL": "Under Approval",
"UNDER_REVIEW": "Under Review",
"UNPROCESSED": "Unprocessed",
"upload-status": { "upload-status": {
"dialog": { "dialog": {
"actions": { "actions": {

View File

@ -4,6 +4,7 @@
"all": "", "all": "",
"none": "" "none": ""
}, },
"active": "",
"add-dossier-dialog": { "add-dossier-dialog": {
"actions": { "actions": {
"save": "", "save": "",
@ -230,6 +231,7 @@
"suggestion-remove-dictionary": "" "suggestion-remove-dictionary": ""
}, },
"annotations": "", "annotations": "",
"archived": "",
"assign-dossier-owner": { "assign-dossier-owner": {
"dialog": { "dialog": {
"approvers": "", "approvers": "",
@ -349,6 +351,7 @@
"delete-dossier": { "delete-dossier": {
"confirmation-text": "", "confirmation-text": "",
"deny-text": "", "deny-text": "",
"details": "",
"question": "", "question": "",
"title": "" "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-menu": {
"filter-options": "", "filter-options": "",
"filter-types": "", "filter-types": "",