Translation rework: annotation supertypes, chevron button, others

This commit is contained in:
Adina Țeudan 2021-07-21 16:15:01 +03:00
parent 588f657192
commit 0db16789d8
11 changed files with 188 additions and 170 deletions

View File

@ -1,26 +1,29 @@
import { Comment, Point, Rectangle } from '@redaction/red-ui-http';
import { RedactionLogEntryWrapper } from './redaction-log-entry.wrapper';
import { annotationTypesTranslations } from '../../translations/annotation-types-translations';
export type AnnotationSuperType =
| 'add-dictionary'
| 'remove-dictionary'
| 'remove-only-here'
| 'change-legal-basis'
| 'suggestion-change-legal-basis'
| 'suggestion-recategorize-image'
| 'suggestion-add-dictionary'
| 'suggestion-force-redaction'
| 'suggestion-remove-dictionary'
| 'suggestion-add'
| 'suggestion-remove'
| 'skipped'
| 'redaction'
| 'manual-redaction'
| 'recommendation'
| 'hint'
| 'pending-analysis'
| 'declined-suggestion';
export class AnnotationWrapper {
superType:
| 'add-dictionary'
| 'remove-dictionary'
| 'remove-only-here'
| 'change-legal-basis'
| 'suggestion-change-legal-basis'
| 'suggestion-recategorize-image'
| 'suggestion-add-dictionary'
| 'suggestion-force-redaction'
| 'suggestion-remove-dictionary'
| 'suggestion-add'
| 'suggestion-remove'
| 'skipped'
| 'redaction'
| 'manual-redaction'
| 'recommendation'
| 'hint'
| 'pending-analysis'
| 'declined-suggestion';
superType: AnnotationSuperType;
dictionary: string;
color: string;
@ -213,7 +216,7 @@ export class AnnotationWrapper {
this._createContent(annotationWrapper, redactionLogEntry);
this._setSuperType(annotationWrapper, redactionLogEntry);
this._handleRecommendations(annotationWrapper, redactionLogEntry);
annotationWrapper.typeLabel = 'annotation-type.' + annotationWrapper.superType;
annotationWrapper.typeLabel = annotationTypesTranslations[annotationWrapper.superType];
return annotationWrapper;
}

View File

@ -28,8 +28,8 @@
<div class="separator"></div>
<redaction-chevron-button
[label]="'file-attributes-csv-import.table-header.actions.type' | translate"
[matMenuTriggerFor]="typeMenu"
text="file-attributes-csv-import.table-header.actions.type"
></redaction-chevron-button>
<mat-menu #readOnlyMenu="matMenu" class="padding-bottom-8">

View File

@ -3,6 +3,7 @@ import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { SuperTypeSorter } from '@utils/sorters/super-type-sorter';
import { FilterModel } from '@shared/components/filters/popup-filter/model/filter.model';
import { handleCheckedValue } from '@shared/components/filters/popup-filter/utils/filter-utils';
import { annotationTypesTranslations } from '../../../translations/annotation-types-translations';
@Injectable()
export class AnnotationProcessingService {
@ -126,7 +127,7 @@ export class AnnotationProcessingService {
key: key,
topLevelFilter: true,
matches: 1,
label: 'annotation-type.' + key,
label: annotationTypesTranslations[key],
filters: []
};
filterMap.set(key, filter);

View File

@ -1,5 +1,5 @@
<button [class.overlay]="showDot" [class.primary]="primary" mat-button>
<span [translate]="text"></span>
<span>{{ label }}</span>
<mat-icon class="chevron-icon" svgIcon="red:arrow-down"></mat-icon>
</button>
<div *ngIf="showDot" class="dot"></div>

View File

@ -7,7 +7,7 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ChevronButtonComponent {
@Input() text: string;
@Input() label: string;
@Input() showDot = false;
@Input() primary = false;
}

View File

@ -1,16 +1,16 @@
<redaction-icon-button
*ngIf="!chevron"
[icon]="icon"
[label]="filterLabel"
[label]="filterLabel || ('filter-menu.label' | translate)"
[matMenuTriggerFor]="filterMenu"
[showDot]="hasActiveFilters"
></redaction-icon-button>
<redaction-chevron-button
*ngIf="chevron"
[label]="filterLabel || ('filter-menu.label' | translate)"
[matMenuTriggerFor]="filterMenu"
[showDot]="hasActiveFilters"
[text]="filterLabel"
></redaction-chevron-button>
<mat-menu #filterMenu="matMenu" (closed)="applyFilters()" [class.padding-bottom-0]="secondaryFilters?.length > 0" xPosition="before">

View File

@ -27,7 +27,7 @@ export class PopupFilterComponent implements OnChanges {
@Input() actionsTemplate: TemplateRef<any>;
@Input() primaryFilters: FilterModel[] = [];
@Input() secondaryFilters: FilterModel[] = [];
@Input() filterLabel = this._translateService.instant('filter-menu.label');
@Input() filterLabel;
@Input() icon: string;
@Input() chevron = false;

View File

@ -0,0 +1,23 @@
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { AnnotationSuperType } from '../models/file/annotation.wrapper';
export const annotationTypesTranslations: { [key in AnnotationSuperType]: string } = {
'add-dictionary': _('annotation-type.add-dictionary'),
'change-legal-basis': _('annotation-type.change-legal-basis'),
'declined-suggestion': _('annotation-type.declined-suggestion'),
hint: _('annotation-type.hint'),
'manual-redaction': _('annotation-type.manual-redaction'),
'pending-analysis': _('annotation-type.pending-analysis'),
recommendation: _('annotation-type.recommendation'),
redaction: _('annotation-type.redaction'),
'remove-dictionary': _('annotation-type.remove-dictionary'),
'remove-only-here': _('annotation-type.remove-only-here'),
skipped: _('annotation-type.skipped'),
'suggestion-add': _('annotation-type.suggestion-add'),
'suggestion-add-dictionary': _('annotation-type.suggestion-add-dictionary'),
'suggestion-change-legal-basis': _('annotation-type.suggestion-change-legal-basis'),
'suggestion-recategorize-image': _('annotation-type.suggestion-recategorize-image'),
'suggestion-force-redaction': _('annotation-type.suggestion-force-redaction'),
'suggestion-remove': _('annotation-type.suggestion-remove'),
'suggestion-remove-dictionary': _('suggestion-remove-dictionary')
};

View File

@ -1,4 +1,10 @@
export const SuperTypeSorter = {
import { AnnotationSuperType } from '../../models/file/annotation.wrapper';
export const SuperTypeSorter: { [key in AnnotationSuperType]: number } = {
'suggestion-change-legal-basis': 14,
'suggestion-force-redaction': 15,
'suggestion-recategorize-image': 16,
recommendation: 7,
'add-dictionary': 2,
'remove-dictionary': 3,
'pending-analysis': 4,
@ -10,7 +16,7 @@ export const SuperTypeSorter = {
'suggestion-remove': 11,
skipped: 50,
redaction: 1,
manual: 2,
hint: 15,
'manual-redaction': 2,
hint: 17,
'declined-suggestion': 20
};

View File

@ -1,15 +1,4 @@
{
"APPROVED": "Approved",
"ERROR": "Re-processing required",
"EXCLUDED": "Excluded",
"FULLREPROCESS": "Processing",
"OCR_PROCESSING": "OCR Processing",
"PROCESSING": "Processing",
"REPROCESS": "Processing",
"UNASSIGNED": "Unassigned",
"UNDER_APPROVAL": "Under Approval",
"UNDER_REVIEW": "Under Review",
"UNPROCESSED": "Unprocessed",
"actions": {
"all": "All",
"none": "None"
@ -64,6 +53,9 @@
"title": "{type, select, edit{Edit {name}} create{Create} other{}} Dictionary"
},
"add-edit-dossier-attribute": {
"error": {
"generic": "Failed to save attribute!"
},
"form": {
"label": "Attribute Name",
"label-placeholder": "Enter Name",
@ -71,10 +63,7 @@
"type": "Attribute Type"
},
"save": "Save Attribute",
"title": "{type, select, edit{Edit {name}} create{Add New} other{}} Dossier Attribute",
"error": {
"generic": "Failed to save attribute!"
}
"title": "{type, select, edit{Edit {name}} create{Add New} other{}} Dossier Attribute"
},
"add-edit-dossier-template": {
"form": {
@ -112,8 +101,8 @@
"email": "Email",
"first-name": "First Name",
"last-name": "Last Name",
"role": "Role",
"reset-password": "Reset Password"
"reset-password": "Reset Password",
"role": "Role"
},
"title": "{type, select, edit{Edit} create{Add New} other{}} User"
},
@ -168,10 +157,6 @@
"error": "Failed to save redaction: {error}",
"success": "Redaction added!"
},
"force-redaction": {
"error": "Failed to save redaction: {error}",
"success": "Redaction added!"
},
"approve": {
"error": "Failed to approve suggestion: {error}",
"success": "Suggestion approved."
@ -184,14 +169,22 @@
"error": "Failed to decline suggestion: {error}",
"success": "Suggestion declined."
},
"request-change-legal-basis": {
"error": "Failed to request annotation reason change: {error}",
"success": "Annotation reason change requested."
"force-redaction": {
"error": "Failed to save redaction: {error}",
"success": "Redaction added!"
},
"recategorize-image": {
"error": "Failed to recategorize image: {error}",
"success": "Image recategorized."
},
"request-change-legal-basis": {
"error": "Failed to request annotation reason change: {error}",
"success": "Annotation reason change requested."
},
"request-force-redaction": {
"error": "Failed to save redaction suggestion: {error}",
"success": "Redaction suggestion saved"
},
"request-image-recategorization": {
"error": "Failed to request image recategorization: {error}",
"success": "Image recategorization requested."
@ -201,10 +194,6 @@
"error": "Failed to save redaction suggestion: {error}",
"success": "Redaction suggestion saved"
},
"request-force-redaction": {
"error": "Failed to save redaction suggestion: {error}",
"success": "Redaction suggestion saved"
},
"undo": {
"error": "Failed to undo: {error}",
"success": "Undo successful"
@ -238,13 +227,14 @@
"suggestion-add": "Suggested redaction",
"suggestion-add-dictionary": "Suggested dictionary add",
"suggestion-change-legal-basis": "Suggested change legal basis",
"suggestion-recategorize-image": "Suggested recategorize image",
"suggestion-force-redaction": "Suggestion force redaction",
"suggestion-recategorize-image": "Suggested recategorize image",
"suggestion-remove": "Suggested redaction removal",
"suggestion-remove-dictionary": "Suggested dictionary removal"
},
"annotations": "Annotations",
"app-name": "DDA-R",
"APPROVED": "Approved",
"archived": "Archived",
"assign-approver-owner": {
"dialog": {
@ -285,17 +275,17 @@
"all-users": "All Users",
"categories": {
"all-categories": "All Categories",
"license": "License",
"download": "Download",
"audit-log": "Audit Log",
"project": "Project",
"dossier": "Dossier",
"dictionary": "Dictionary",
"project-template": "Project Template",
"user": "User",
"document": "Document",
"audit": "Audit",
"dossier-template": "Dossier Template"
"audit-log": "Audit Log",
"dictionary": "Dictionary",
"document": "Document",
"dossier": "Dossier",
"dossier-template": "Dossier Template",
"download": "Download",
"license": "License",
"project": "Project",
"project-template": "Project Template",
"user": "User"
},
"no-data": {
"title": "No available logs."
@ -521,9 +511,9 @@
},
"dossier-attribute-types": {
"date": "Date",
"image": "Image",
"number": "Number",
"text": "Free Text",
"image": "Image"
"text": "Free Text"
},
"dossier-attributes": "Dossier Attributes",
"dossier-attributes-listing": {
@ -535,13 +525,13 @@
"bulk": {
"delete": "Delete Selected Attributes"
},
"no-match": {
"title": "No attributes match your current filters."
},
"no-data": {
"action": "New Attribute",
"title": "There are no dossier attributes."
},
"no-match": {
"title": "No attributes match your current filters."
},
"search": "Search...",
"table-col-names": {
"label": "Label",
@ -634,8 +624,8 @@
},
"dossier-details": {
"attributes": {
"image-uploaded": "Image uploaded",
"expand": "{count} custom attributes",
"image-uploaded": "Image uploaded",
"show-less": "show less"
},
"charts": {
@ -781,6 +771,14 @@
"revert": "Revert",
"save": "Save Changes"
},
"attributes": {
"custom-attributes": "Custom Dossier Attributes",
"delete-image": "Delete Image",
"image-attributes": "Image Attributes",
"no-custom-attributes": "There are no text attributes",
"no-image-attributes": "There are no image attributes",
"upload-image": "Upload Image"
},
"change-successful": "Dossier was updated.",
"delete-successful": "Dossier was deleted.",
"dictionary": {
@ -814,17 +812,11 @@
"report-attributes": "Report Attributes",
"team-members": "Team Members"
},
"attributes": {
"custom-attributes": "Custom Dossier Attributes",
"image-attributes": "Image Attributes",
"upload-image": "Upload Image",
"delete-image": "Delete Image",
"no-custom-attributes": "There are no text attributes",
"no-image-attributes": "There are no image attributes"
},
"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",
@ -950,10 +942,10 @@
"jump-to-next": "Jump to Next",
"jump-to-previous": "Jump to Previous",
"label": "Workload",
"page-is": "This page is",
"select": "Select",
"select-all": "All",
"select-none": "None",
"page-is": "This page is"
"select-none": "None"
},
"document-info": {
"close": "Close Document Info",
@ -1011,6 +1003,7 @@
"status": "Status"
},
"finished": "Finished",
"FULLREPROCESS": "Processing",
"hint": "Hint",
"initials-avatar": {
"unassigned": "Unassigned",
@ -1087,6 +1080,7 @@
"tomorrow": "Tomorrow",
"yesterday": "Yesterday"
},
"OCR_PROCESSING": "OCR Processing",
"overwrite-files-dialog": {
"options": {
"cancel": "Cancel all uploads",
@ -1111,6 +1105,7 @@
},
"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": {
@ -1124,10 +1119,10 @@
},
"header": "Edit Image Type",
"options": {
"formula": "Formula",
"image": "Image",
"logo": "Logo",
"signature": "Signature",
"formula": "Formula"
"signature": "Signature"
}
},
"redaction": "Redaction",
@ -1162,16 +1157,17 @@
"title": "Reports",
"upload-document": "Upload a Document"
},
"REPROCESS": "Processing",
"reset-filters": "Reset Filters",
"reset-password-dialog": {
"header": "Set Temporary Password for {userName}",
"actions": {
"cancel": "Cancel",
"save": "Save"
},
"form": {
"password": "Temporary password"
},
"actions": {
"save": "Save",
"cancel": "Cancel"
}
"header": "Set Temporary Password for {userName}"
},
"roles": {
"inactive": "Inactive",
@ -1259,66 +1255,13 @@
"submitted": "Submitted",
"suggestion": "Suggestion for redaction",
"time": {
"no-time-left": "Time to restore already passed",
"less-than-an-hour": "< 1 hour",
"day": "day",
"days": "days",
"hour": "hour",
"hours": "hours",
"day": "day",
"days": "days"
"less-than-an-hour": "< 1 hour",
"no-time-left": "Time to restore already passed"
},
"top-bar": {
"navigation-items": {
"back": "Back",
"dossiers": "Active Dossier",
"my-account": {
"children": {
"admin": "Settings",
"downloads": "My Downloads",
"my-profile": "My Profile",
"trash": "Trash",
"logout": "Logout"
}
}
}
},
"trash": {
"label": "Trash",
"table-header": {
"title": "{length} deleted dossiers",
"info": "Deleted items can be restored up to {hours} hours from their deletions"
},
"bulk": {
"delete": "Forever Delete Selected Dossiers",
"restore": "Restore Selected Dossiers"
},
"action": {
"delete": "Delete forever",
"restore": "Restore"
},
"search": "Search...",
"table-col-names": {
"name": "Name",
"owner": "Owner",
"deleted-on": "Deleted on",
"time-to-restore": "Time to restore"
},
"no-data": {
"title": "There are no dossiers yet."
},
"no-match": {
"title": "No dossiers match your current filters."
}
},
"sorting": {
"alphabetically": "Alphabetically",
"custom": "Custom",
"number-of-analyses": "Number of analyses",
"number-of-pages": "Number of pages",
"oldest": "Oldest",
"recent": "Recent"
},
"submitted": "Submitted",
"suggestion": "Suggestion for redaction",
"top-bar": {
"navigation-items": {
"back": "Back",
@ -1332,14 +1275,46 @@
"en": "English",
"label": "Language"
},
"logout": "Logout",
"my-profile": "My Profile",
"trash": "Trash",
"logout": "Logout"
"trash": "Trash"
}
}
}
},
"trash": {
"action": {
"delete": "Delete forever",
"restore": "Restore"
},
"bulk": {
"delete": "Forever Delete Selected Dossiers",
"restore": "Restore Selected Dossiers"
},
"label": "Trash",
"no-data": {
"title": "There are no dossiers yet."
},
"no-match": {
"title": "No dossiers match your current filters."
},
"search": "Search...",
"table-col-names": {
"deleted-on": "Deleted on",
"name": "Name",
"owner": "Owner",
"time-to-restore": "Time to restore"
},
"table-header": {
"info": "Deleted items can be restored up to {hours} hours from their deletions",
"title": "{length} deleted dossiers"
}
},
"type": "Type",
"UNASSIGNED": "Unassigned",
"UNDER_APPROVAL": "Under Approval",
"UNDER_REVIEW": "Under Review",
"UNPROCESSED": "Unprocessed",
"upload-status": {
"dialog": {
"actions": {
@ -1380,8 +1355,8 @@
"user-management": "User Management",
"user-profile": {
"actions": {
"save": "Save profile",
"change-password": "Change Password"
"change-password": "Change Password",
"save": "Save profile"
},
"form": {
"email": "Email",

View File

@ -47,7 +47,8 @@
"rank-placeholder": "",
"redaction": ""
},
"save": ""
"save": "",
"title": ""
},
"add-edit-dossier-attribute": {
"form": {
@ -57,10 +58,7 @@
"type": ""
},
"save": "",
"title": {
"edit": "",
"new": ""
}
"title": ""
},
"add-edit-dossier-template": {
"form": {
@ -72,10 +70,7 @@
"valid-to": ""
},
"save": "",
"title": {
"edit": "",
"new": ""
}
"title": ""
},
"add-edit-file-attribute": {
"form": {
@ -88,10 +83,7 @@
"type": ""
},
"save": "",
"title": {
"edit": "",
"new": ""
}
"title": ""
},
"add-edit-user": {
"actions": {
@ -107,10 +99,7 @@
"reset-password": "",
"role": ""
},
"title": {
"edit": "",
"new": ""
}
"title": ""
},
"annotation": "",
"annotation-actions": {
@ -137,6 +126,25 @@
"show": "",
"undo": ""
},
"annotation-type": {
"add-dictionary": "",
"change-legal-basis": "",
"declined-suggestion": "",
"hint": "",
"manual-redaction": "",
"pending-analysis": "",
"recommendation": "",
"redaction": "",
"remove-dictionary": "",
"remove-only-here": "",
"skipped": "",
"suggestion-add": "",
"suggestion-add-dictionary": "",
"suggestion-change-legal-basis": "",
"suggestion-force-redaction": "",
"suggestion-recategorize-image": "",
"suggestion-remove": ""
},
"annotations": "",
"assign-": "",
"assign-dossier-owner": {
@ -207,6 +215,7 @@
},
"comments": {
"add-comment": "",
"comments": "",
"hide-comments": ""
},
"common": {
@ -986,6 +995,7 @@
"subtitle": "",
"title": ""
},
"suggestion-remove-dictionary": "",
"top-bar": {
"navigation-items": {
"back": "",