Translation rework: add/edit titles

This commit is contained in:
Adina Țeudan 2021-07-21 15:10:28 +03:00
parent 99c9cba325
commit 588f657192
8 changed files with 46 additions and 59 deletions

View File

@ -41,8 +41,8 @@ export class AddEditDictionaryDialogComponent {
}
get dialogHeader(): string {
const i18nString = 'add-edit-dictionary.title.' + (this.dictionary ? 'edit' : 'new');
return this._translateService.instant(i18nString, {
return this._translateService.instant('add-edit-dictionary.title', {
type: this.dictionary ? 'edit' : 'create',
name: humanize(this.dictionary?.type)
});
}

View File

@ -1,10 +1,12 @@
<section class="dialog">
<div class="dialog-header heading-l">
{{
(dossierAttribute ? 'add-edit-dossier-attribute.title.edit' : 'add-edit-dossier-attribute.title.new')
| translate: { name: dossierAttribute?.label }
}}
</div>
<div
[translateParams]="{
name: dossierAttribute?.label,
type: dossierAttribute ? 'edit' : 'create'
}"
[translate]="'add-edit-dossier-attribute.title'"
class="dialog-header heading-l"
></div>
<form (submit)="saveFileAttribute()" [formGroup]="dossierAttributeForm">
<div class="dialog-content">

View File

@ -1,10 +1,12 @@
<section class="dialog">
<div class="dialog-header heading-l">
{{
(dossierTemplate ? 'add-edit-dossier-template.title.edit' : 'add-edit-dossier-template.title.new')
| translate: { name: dossierTemplate?.name }
}}
</div>
<div
[translateParams]="{
type: dossierTemplate ? 'edit' : 'create',
name: dossierTemplate?.name
}"
[translate]="'add-edit-dossier-template.title'"
class="dialog-header heading-l"
></div>
<form (submit)="saveDossierTemplate()" [formGroup]="dossierTemplateForm">
<div class="dialog-content">

View File

@ -1,10 +1,12 @@
<section class="dialog">
<div class="dialog-header heading-l">
{{
(fileAttribute ? 'add-edit-file-attribute.title.edit' : 'add-edit-file-attribute.title.new')
| translate: { name: fileAttribute?.label }
}}
</div>
<div
[translateParams]="{
type: fileAttribute ? 'edit' : 'create',
name: fileAttribute?.label
}"
[translate]="'add-edit-file-attribute.title'"
class="dialog-header heading-l"
></div>
<form (submit)="saveFileAttribute()" [formGroup]="fileAttributeForm">
<div class="dialog-content">

View File

@ -1,6 +1,10 @@
<div class="dialog-header heading-l">
{{ (user ? 'add-edit-user.title.edit' : 'add-edit-user.title.new') | translate }}
</div>
<div
[translateParams]="{
type: user ? 'edit' : 'create'
}"
[translate]="'add-edit-user.title'"
class="dialog-header heading-l"
></div>
<form (submit)="save()" [formGroup]="userForm">
<div class="dialog-content">

View File

@ -202,7 +202,7 @@
<div class="actions-wrapper">
<div
(click)="toggleExpandComments(annotation, $event)"
[matTooltip]="commentsTooltip(annotation)"
[matTooltip]="'comments.comments' | translate: { count: annotation.comments?.length }"
class="comments-counter"
matTooltipPosition="above"
>

View File

@ -20,7 +20,6 @@ import { FileDataModel } from '@models/file/file-data.model';
import { FilterModel } from '@shared/components/filters/popup-filter/model/filter.model';
import { CommentsComponent } from '../comments/comments.component';
import { PermissionsService } from '@services/permissions.service';
import { TranslateService } from '@ngx-translate/core';
import { WebViewerInstance } from '@pdftron/webviewer';
const COMMAND_KEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Escape'];
@ -60,8 +59,7 @@ export class FileWorkloadComponent {
constructor(
private readonly _permissionsService: PermissionsService,
private readonly _changeDetectorRef: ChangeDetectorRef,
private readonly _annotationProcessingService: AnnotationProcessingService,
private readonly _translateService: TranslateService
private readonly _annotationProcessingService: AnnotationProcessingService
) {}
private _annotations: AnnotationWrapper[];
@ -114,11 +112,6 @@ export class FileWorkloadComponent {
}
}
commentsTooltip({ comments }: AnnotationWrapper): string {
const i18nString = 'comments.' + (comments.length === 1 ? 'comment' : 'comments');
return this._translateService.instant(i18nString, { count: comments.length });
}
isSelected(annotation: AnnotationWrapper) {
return this.selectedAnnotations?.find(a => a?.id === annotation.id);
}

View File

@ -61,10 +61,7 @@
"redaction": "Redaction"
},
"save": "Save Dictionary",
"title": {
"edit": "Edit {name} Dictionary",
"new": "Create Dictionary"
}
"title": "{type, select, edit{Edit {name}} create{Create} other{}} Dictionary"
},
"add-edit-dossier-attribute": {
"form": {
@ -74,10 +71,7 @@
"type": "Attribute Type"
},
"save": "Save Attribute",
"title": {
"edit": "Edit {name} Dossier Attribute",
"new": "Add New Dossier Attribute"
},
"title": "{type, select, edit{Edit {name}} create{Add New} other{}} Dossier Attribute",
"error": {
"generic": "Failed to save attribute!"
}
@ -92,10 +86,7 @@
"valid-to": "Valid to"
},
"save": "Save Dossier Template",
"title": {
"edit": "Edit {name} Dossier Template",
"new": "Create Dossier Template"
}
"title": "{type, select, edit{Edit {name}} create{Create} other{}} Dossier Template"
},
"add-edit-file-attribute": {
"form": {
@ -108,10 +99,7 @@
"type": "Type"
},
"save": "Save Attribute",
"title": {
"edit": "Edit {name} File Attribute",
"new": "Add New File Attribute"
}
"title": "{type, select, edit{Edit {name}} create{Add New} other{}} File Attribute"
},
"add-edit-user": {
"actions": {
@ -127,10 +115,7 @@
"role": "Role",
"reset-password": "Reset Password"
},
"title": {
"edit": "Edit User",
"new": "Add New User"
}
"title": "{type, select, edit{Edit} create{Add New} other{}} User"
},
"annotation": "Annotation",
"annotation-actions": {
@ -352,8 +337,7 @@
"comments": {
"add-comment": "Enter comment",
"cancel": "Cancel",
"comment": "{count} comment",
"comments": "{count} comments",
"comments": "{count} {count, plural, one{comment} other{comments}}",
"hide-comments": "Hide comments"
},
"common": {
@ -376,11 +360,11 @@
"warning": "Warning: this cannot be undone!"
},
"confirm-delete-users": {
"cancel": "Keep {usersCount, plural, =0{} one{User} other{Users}}",
"delete": "Delete {usersCount, plural, =0{} one{User} other{Users}}",
"impacted-documents": "All documents pending review from the {usersCount, plural, =0{} one{user} other{users}} will be impacted",
"impacted-dossiers": "{dossiersCount} {dossiersCount, plural, =0{dossiers} one{dossier} other{dossiers}} will be impacted",
"title": "Delete {usersCount, plural, =0{} one{User} other{Users}} from Workspace",
"cancel": "Keep {usersCount, plural, one{User} other{Users}}",
"delete": "Delete {usersCount, plural, one{User} other{Users}}",
"impacted-documents": "All documents pending review from the {usersCount, plural, one{user} other{users}} will be impacted",
"impacted-dossiers": "{dossiersCount} {dossiersCount, plural, one{dossier} other{dossiers}} will be impacted",
"title": "Delete {usersCount, plural, one{User} other{Users}} from Workspace",
"toast-error": "Please confirm that you understand the ramifications of your action!",
"warning": "Warning: this cannot be undone!"
},