Translation rework: file attribute types, languages

This commit is contained in:
Adina Țeudan 2021-07-21 14:28:43 +03:00
parent 99b6676641
commit 3894c1e95c
20 changed files with 43 additions and 24 deletions

View File

@ -26,7 +26,7 @@
<label translate="top-bar.navigation-items.my-account.children.language.label"></label>
<mat-select formControlName="language">
<mat-option *ngFor="let language of languages" [value]="language">
{{ 'top-bar.navigation-items.my-account.children.language.' + language | translate }}
{{ translations[language] | translate }}
</mat-option>
</mat-select>
</div>

View File

@ -7,6 +7,7 @@ import { TranslateService } from '@ngx-translate/core';
import { UserControllerService } from '@redaction/red-ui-http';
import { AppConfigKey, AppConfigService } from '@app-config/app-config.service';
import { DomSanitizer } from '@angular/platform-browser';
import { languagesTranslations } from '../../translations/languages-translations';
@Component({
selector: 'redaction-user-profile-screen',
@ -17,6 +18,7 @@ export class UserProfileScreenComponent implements OnInit {
viewReady = false;
formGroup: FormGroup;
changePasswordUrl: any;
translations = languagesTranslations;
private _profileModel: ProfileModel;

View File

@ -8,7 +8,7 @@ import { HttpErrorResponse } from '@angular/common/http';
import { Toaster } from '@services/toaster.service';
import { AutoUnsubscribeComponent } from '@shared/base/auto-unsubscribe.component';
import { DossierAttributesService } from '@shared/services/controller-wrappers/dossier-attributes.service';
import dossierAttributeTypesTranslations from '../../translations/dossier-attribute-types-translations';
import { dossierAttributeTypesTranslations } from '../../translations/dossier-attribute-types-translations';
@Component({
selector: 'redaction-add-edit-dossier-attribute-dialog',

View File

@ -32,7 +32,7 @@
<label translate="add-edit-file-attribute.form.type"></label>
<mat-select formControlName="type">
<mat-option *ngFor="let type of typeOptions" [value]="type">
{{ 'file-attribute-types.' + type | translate }}
{{ translations[type] | translate }}
</mat-option>
</mat-select>
</div>

View File

@ -3,6 +3,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { AppStateService } from '@state/app-state.service';
import { FileAttributeConfig } from '@redaction/red-ui-http';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { fileAttributeTypesTranslations } from '../../translations/file-attribute-types-translations';
@Component({
selector: 'redaction-add-edit-file-attribute-dialog',
@ -14,6 +15,7 @@ export class AddEditFileAttributeDialogComponent {
fileAttribute: FileAttributeConfig;
dossierTemplateId: string;
readonly typeOptions = [FileAttributeConfig.TypeEnum.TEXT, FileAttributeConfig.TypeEnum.NUMBER, FileAttributeConfig.TypeEnum.DATE];
translations = fileAttributeTypesTranslations;
constructor(
private readonly _appStateService: AppStateService,

View File

@ -5,7 +5,7 @@ import { Toaster } from '@services/toaster.service';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { TranslateService } from '@ngx-translate/core';
import { DefaultColorType } from '@models/default-color-key.model';
import defaultColorsTranslations from '../../translations/default-colors-translations';
import { defaultColorsTranslations } from '../../translations/default-colors-translations';
@Component({
selector: 'redaction-edit-color-dialog',

View File

@ -47,7 +47,7 @@
<mat-menu #typeMenu="matMenu" class="padding-bottom-8">
<button (click)="setAttributeForSelection('type', type)" *ngFor="let type of typeOptions" mat-menu-item>
{{ 'file-attribute-types.' + type | translate }}
{{ translations[type] | translate }}
</button>
</mat-menu>
</ng-container>
@ -134,7 +134,7 @@
<mat-form-field class="no-label">
<mat-select [(ngModel)]="field.type">
<mat-option *ngFor="let type of typeOptions" [value]="type">
{{ 'file-attribute-types.' + type | translate }}
{{ translations[type] | translate }}
</mat-option>
</mat-select>
</mat-form-field>

View File

@ -6,6 +6,7 @@ import { SearchService } from '@shared/services/search.service';
import { ScreenStateService } from '@shared/services/screen-state.service';
import { SortingService } from '@services/sorting.service';
import { BaseListingComponent } from '@shared/base/base-listing.component';
import { fileAttributeTypesTranslations } from '../../../translations/file-attribute-types-translations';
@Component({
selector: 'redaction-active-fields-listing',
@ -18,6 +19,7 @@ export class ActiveFieldsListingComponent extends BaseListingComponent<Field> im
@Output() entitiesChange = new EventEmitter<Field[]>();
@Output() setHoveredColumn = new EventEmitter<string>();
@Output() toggleFieldActive = new EventEmitter<Field>();
translations = fileAttributeTypesTranslations;
readonly typeOptions = [FileAttributeConfig.TypeEnum.TEXT, FileAttributeConfig.TypeEnum.NUMBER, FileAttributeConfig.TypeEnum.DATE];
protected readonly _primaryKey = 'id';

View File

@ -6,7 +6,7 @@ import { Moment } from 'moment';
import { applyIntervalConstraints } from '@utils/date-inputs-utils';
import { LoadingService } from '@services/loading.service';
import { AutoUnsubscribeComponent } from '@shared/base/auto-unsubscribe.component';
import auditCategoriesTranslations from '../../translations/audit-categories-translations';
import { auditCategoriesTranslations } from '../../translations/audit-categories-translations';
const PAGE_SIZE = 50;

View File

@ -11,7 +11,7 @@ import { ScreenStateService } from '@shared/services/screen-state.service';
import { BaseListingComponent } from '@shared/base/base-listing.component';
import { DefaultColorType } from '@models/default-color-key.model';
import { SortingService } from '@services/sorting.service';
import defaultColorsTranslations from '../../translations/default-colors-translations';
import { defaultColorsTranslations } from '../../translations/default-colors-translations';
@Component({
templateUrl: './default-colors-screen.component.html',

View File

@ -11,7 +11,7 @@ import { SearchService } from '@shared/services/search.service';
import { ScreenStateService } from '@shared/services/screen-state.service';
import { PermissionsService } from '@services/permissions.service';
import { DossierAttributesService } from '@shared/services/controller-wrappers/dossier-attributes.service';
import dossierAttributeTypesTranslations from '../../translations/dossier-attribute-types-translations';
import { dossierAttributeTypesTranslations } from '../../translations/dossier-attribute-types-translations';
@Component({
templateUrl: './dossier-attributes-listing-screen.component.html',

View File

@ -130,7 +130,7 @@
<span>{{ attribute.label }}</span>
</div>
<div [translate]="'file-attribute-types.' + attribute.type" class="small-label"></div>
<div [translate]="translations[attribute.type]" class="small-label"></div>
<div class="center read-only">
<mat-icon

View File

@ -10,6 +10,7 @@ import { SearchService } from '@shared/services/search.service';
import { ScreenStateService } from '@shared/services/screen-state.service';
import { SortingService } from '@services/sorting.service';
import { BaseListingComponent } from '@shared/base/base-listing.component';
import { fileAttributeTypesTranslations } from '../../translations/file-attribute-types-translations';
@Component({
templateUrl: './file-attributes-listing-screen.component.html',
@ -18,8 +19,8 @@ import { BaseListingComponent } from '@shared/base/base-listing.component';
providers: [FilterService, SearchService, ScreenStateService, SortingService]
})
export class FileAttributesListingScreenComponent extends BaseListingComponent<FileAttributeConfig> implements OnInit, OnDestroy {
translations = fileAttributeTypesTranslations;
protected readonly _primaryKey = 'label';
private _existingConfiguration: FileAttributesConfig;
@ViewChild('fileInput') private _fileInput: ElementRef;

View File

@ -1,6 +1,6 @@
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
const auditCategoriesTranslations: { [key: string]: string } = {
export const auditCategoriesTranslations: { [key: string]: string } = {
allCategories: _('audit-screen.categories.all-categories'),
LICENSE: _('audit-screen.categories.license'),
DOWNLOAD: _('audit-screen.categories.download'),
@ -14,5 +14,3 @@ const auditCategoriesTranslations: { [key: string]: string } = {
AUDIT: _('audit-screen.categories.audit'),
DOSSIER_TEMPLATE: _('audit-screen.categories.dossier-template')
};
export default auditCategoriesTranslations;

View File

@ -1,7 +1,7 @@
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { DefaultColorType } from '@models/default-color-key.model';
const defaultColorsTranslations: { [key in DefaultColorType]: string } = {
export const defaultColorsTranslations: { [key in DefaultColorType]: string } = {
analysisColor: _('default-colors-screen.types.analysisColor'),
defaultColor: _('default-colors-screen.types.defaultColor'),
dictionaryRequestColor: _('default-colors-screen.types.dictionaryRequestColor'),
@ -12,5 +12,3 @@ const defaultColorsTranslations: { [key in DefaultColorType]: string } = {
requestRemove: _('default-colors-screen.types.requestRemove'),
updatedColor: _('default-colors-screen.types.updatedColor')
};
export default defaultColorsTranslations;

View File

@ -1,11 +1,9 @@
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { DossierAttributeConfig } from '@redaction/red-ui-http';
const dossierAttributeTypesTranslations: { [key in DossierAttributeConfig.TypeEnum]: string } = {
export const dossierAttributeTypesTranslations: { [key in DossierAttributeConfig.TypeEnum]: string } = {
TEXT: _('dossier-attribute-types.text'),
NUMBER: _('dossier-attribute-types.number'),
DATE: _('dossier-attribute-types.date'),
IMAGE: _('dossier-attribute-types.image')
};
export default dossierAttributeTypesTranslations;

View File

@ -0,0 +1,8 @@
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { FileAttributeConfig } from '@redaction/red-ui-http';
export const fileAttributeTypesTranslations: { [key in FileAttributeConfig.TypeEnum]: string } = {
TEXT: _('file-attribute-types.text'),
NUMBER: _('file-attribute-types.number'),
DATE: _('file-attribute-types.date')
};

View File

@ -0,0 +1,6 @@
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
export const languagesTranslations: { [key: string]: string } = {
en: _('top-bar.navigation-items.my-account.children.language.en'),
de: _('top-bar.navigation-items.my-account.children.language.de')
};

View File

@ -842,9 +842,9 @@
},
"efsa": "EFSA Approval",
"file-attribute-types": {
"DATE": "Date",
"NUMBER": "Number",
"TEXT": "Free Text"
"date": "Date",
"number": "Number",
"text": "Free Text"
},
"file-attributes": "File Attributes",
"file-attributes-csv-import": {

View File

@ -630,7 +630,9 @@
}
},
"file-attribute-types": {
"": ""
"date": "",
"number": "",
"text": ""
},
"file-attributes-csv-import": {
"action": {
@ -984,6 +986,8 @@
"my-account": {
"children": {
"language": {
"de": "",
"en": "",
"label": ""
},
"logout": ""