Clean up translations
This commit is contained in:
parent
cc8c1f9428
commit
7d06252819
@ -7,7 +7,7 @@ import { HTTP_INTERCEPTORS, HttpClient, HttpClientModule } from '@angular/common
|
||||
import { BaseScreenComponent } from '@components/base-screen/base-screen.component';
|
||||
import { ApiModule } from '@redaction/red-ui-http';
|
||||
import { ApiPathInterceptor } from '@utils/api-path-interceptor';
|
||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
import { MissingTranslationHandler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
||||
import { languageInitializer } from '@i18n/language.initializer';
|
||||
import { LanguageService } from '@i18n/language.service';
|
||||
@ -29,6 +29,7 @@ import { PlatformLocation } from '@angular/common';
|
||||
import { BASE_HREF } from './tokens';
|
||||
import { MONACO_PATH, MonacoEditorModule } from '@materia-ui/ngx-monaco-editor';
|
||||
import { ChunkLoaderErrorHandler } from '@utils/chunk-loader-error-handler';
|
||||
import { REDMissingTranslationHandler } from '@utils/missing-translations-handler';
|
||||
|
||||
export function httpLoaderFactory(httpClient: HttpClient) {
|
||||
return new TranslateHttpLoader(httpClient, '/assets/i18n/', '.json');
|
||||
@ -110,6 +111,10 @@ const components = [
|
||||
{
|
||||
provide: MONACO_PATH,
|
||||
useValue: 'https://unpkg.com/monaco-editor@0.24.0/min/vs'
|
||||
},
|
||||
{
|
||||
provide: MissingTranslationHandler,
|
||||
useClass: REDMissingTranslationHandler
|
||||
}
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<section>
|
||||
<p
|
||||
*ngIf="!configuredAdminName && !configuredAdminUrl"
|
||||
[translate]="'auth-error.heading'"
|
||||
class="heading-xl"
|
||||
translate="auth-error.heading"
|
||||
></p>
|
||||
<p
|
||||
*ngIf="configuredAdminName && configuredAdminUrl"
|
||||
@ -22,5 +22,5 @@
|
||||
[innerHTML]="'auth-error.heading-with-link' | translate: { adminName: configuredAdminName }"
|
||||
class="heading-xl"
|
||||
></p>
|
||||
<a (click)="logout()" [translate]="'auth-error.logout'"></a>
|
||||
<a (click)="logout()" translate="auth-error.logout"></a>
|
||||
</section>
|
||||
|
||||
@ -3,29 +3,29 @@
|
||||
<div class="overlay-shadow"></div>
|
||||
<div class="dialog">
|
||||
<div class="dialog-header">
|
||||
<div [translate]="'user-profile.title'" class="heading-l"></div>
|
||||
<div class="heading-l" translate="user-profile.title"></div>
|
||||
</div>
|
||||
<form (submit)="save()" [formGroup]="formGroup">
|
||||
<div class="dialog-content">
|
||||
<div class="dialog-content-left">
|
||||
<div class="red-input-group required">
|
||||
<label [translate]="'user-profile.form.email'"></label>
|
||||
<label translate="user-profile.form.email"></label>
|
||||
<input formControlName="email" name="email" type="email" />
|
||||
</div>
|
||||
|
||||
<div class="red-input-group">
|
||||
<label [translate]="'user-profile.form.first-name'"></label>
|
||||
<label translate="user-profile.form.first-name"></label>
|
||||
<input formControlName="firstName" name="firstName" type="text" />
|
||||
</div>
|
||||
|
||||
<div class="red-input-group">
|
||||
<label [translate]="'user-profile.form.last-name'"></label>
|
||||
<label translate="user-profile.form.last-name"></label>
|
||||
<input formControlName="lastName" name="lastName" type="text" />
|
||||
</div>
|
||||
<div class="red-input-group">
|
||||
<label
|
||||
[translate]="
|
||||
'top-bar.navigation-items.my-account.children.language.label'
|
||||
translate="
|
||||
top-bar.navigation-items.my-account.children.language.label
|
||||
"
|
||||
></label>
|
||||
<mat-select formControlName="language">
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
*ngFor="let category of categories"
|
||||
[value]="category"
|
||||
>
|
||||
{{ category | translate }}
|
||||
{{ 'audit-screen.categories.' + category | translate }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
@ -154,9 +154,7 @@
|
||||
size="small"
|
||||
></redaction-initials-avatar>
|
||||
</div>
|
||||
<div>
|
||||
{{ log.category }}
|
||||
</div>
|
||||
<div [translate]="'audit-screen.categories.' + log.category"></div>
|
||||
<div class="scrollbar-placeholder"></div>
|
||||
</div>
|
||||
</cdk-virtual-scroll-viewport>
|
||||
|
||||
@ -14,7 +14,7 @@ const PAGE_SIZE = 50;
|
||||
styleUrls: ['./audit-screen.component.scss']
|
||||
})
|
||||
export class AuditScreenComponent {
|
||||
readonly ALL_CATEGORIES = 'audit-screen.all-categories';
|
||||
readonly ALL_CATEGORIES = 'all-categories';
|
||||
readonly ALL_USERS = 'audit-screen.all-users';
|
||||
|
||||
filterForm: FormGroup;
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
<div class="attributes-actions-container">
|
||||
<redaction-input-with-action
|
||||
[form]="searchForm"
|
||||
[placeholder]="'dictionary-listing.search'"
|
||||
placeholder="dictionary-listing.search"
|
||||
type="search"
|
||||
></redaction-input-with-action>
|
||||
<div class="actions">
|
||||
@ -154,7 +154,7 @@
|
||||
</div>
|
||||
|
||||
<div class="actions-container">
|
||||
<div class="action-buttons" *ngIf="permissionsService.isAdmin()">
|
||||
<div *ngIf="permissionsService.isAdmin()" class="action-buttons">
|
||||
<redaction-circle-button
|
||||
(action)="openDeleteDictionariesDialog($event, [dict.type])"
|
||||
icon="red:trash"
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
<div class="actions flex-1">
|
||||
<redaction-input-with-action
|
||||
[form]="searchForm"
|
||||
[placeholder]="'dossier-templates-listing.search'"
|
||||
placeholder="dossier-templates-listing.search"
|
||||
type="search"
|
||||
></redaction-input-with-action>
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
<div class="attributes-actions-container">
|
||||
<redaction-input-with-action
|
||||
[form]="searchForm"
|
||||
[placeholder]="'file-attributes-listing.search'"
|
||||
placeholder="file-attributes-listing.search"
|
||||
type="search"
|
||||
></redaction-input-with-action>
|
||||
<input
|
||||
|
||||
@ -33,15 +33,15 @@
|
||||
color="primary"
|
||||
></mat-slide-toggle>
|
||||
<span
|
||||
translate="smtp-config-screen.general.form.forgot-password"
|
||||
class="ml-8"
|
||||
translate="smtp-config-screen.general.form.forgot-password"
|
||||
></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dialog-actions">
|
||||
<button
|
||||
[disabled]="!generalConfigChanged"
|
||||
(click)="saveGeneralConfig()"
|
||||
[disabled]="!generalConfigChanged"
|
||||
color="primary"
|
||||
mat-flat-button
|
||||
type="submit"
|
||||
@ -73,14 +73,7 @@
|
||||
|
||||
<div class="red-input-group w-100">
|
||||
<label translate="smtp-config-screen.form.port"></label>
|
||||
<input
|
||||
formControlName="port"
|
||||
name="port"
|
||||
placeholder="{{
|
||||
'smtp-config-screen.form.port-placeholder' | translate
|
||||
}}"
|
||||
type="number"
|
||||
/>
|
||||
<input formControlName="port" name="port" type="number" />
|
||||
</div>
|
||||
|
||||
<div class="red-input-group required">
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<div class="actions">
|
||||
<redaction-input-with-action
|
||||
[form]="searchForm"
|
||||
[placeholder]="'user-listing.search'"
|
||||
placeholder="user-listing.search"
|
||||
type="search"
|
||||
></redaction-input-with-action>
|
||||
<redaction-icon-button
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
</div>
|
||||
|
||||
<div class="right-container" redactionHasScrollbar>
|
||||
<div [translate]="'watermark-screen.title'" class="heading-xl"></div>
|
||||
<div class="heading-xl" translate="watermark-screen.title"></div>
|
||||
<form (keyup)="configChanged()" [formGroup]="configForm">
|
||||
<div class="red-input-group w-300">
|
||||
<textarea
|
||||
|
||||
@ -22,9 +22,9 @@
|
||||
(action)="addComment()"
|
||||
*ngIf="permissionsService.canAddComment()"
|
||||
[form]="commentForm"
|
||||
[placeholder]="translateService.instant('comments.add-comment')"
|
||||
autocomplete="off"
|
||||
icon="red:collapse"
|
||||
placeholder="comments.add-comment"
|
||||
type="action"
|
||||
width="full"
|
||||
></redaction-input-with-action>
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div [translate]="'assign-dossier-owner.dialog.approvers'" class="all-caps-label mt-16"></div>
|
||||
<div class="all-caps-label mt-16" translate="assign-dossier-owner.dialog.approvers"></div>
|
||||
<redaction-team-members
|
||||
(remove)="toggleSelected($event)"
|
||||
[canAdd]="false"
|
||||
@ -26,7 +26,7 @@
|
||||
class="info"
|
||||
></pre>
|
||||
|
||||
<div [translate]="'assign-dossier-owner.dialog.reviewers'" class="all-caps-label mt-16"></div>
|
||||
<div class="all-caps-label mt-16" translate="assign-dossier-owner.dialog.reviewers"></div>
|
||||
<redaction-team-members
|
||||
(remove)="toggleSelected($event)"
|
||||
[canAdd]="false"
|
||||
@ -45,9 +45,9 @@
|
||||
|
||||
<redaction-input-with-action
|
||||
[form]="searchForm"
|
||||
[placeholder]="'assign-dossier-owner.dialog.search' | translate"
|
||||
[width]="560"
|
||||
class="search-container"
|
||||
placeholder="assign-dossier-owner.dialog.search"
|
||||
type="search"
|
||||
></redaction-input-with-action>
|
||||
|
||||
@ -72,7 +72,7 @@
|
||||
[active]="isApprover(userId)"
|
||||
class="mr-8"
|
||||
></redaction-round-checkbox>
|
||||
<span [translate]="'assign-dossier-owner.dialog.make-approver'"></span>
|
||||
<span translate="assign-dossier-owner.dialog.make-approver"></span>
|
||||
</div>
|
||||
<mat-icon *ngIf="!isOwner(userId)" svgIcon="red:check"></mat-icon>
|
||||
</div>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<section class="dialog">
|
||||
<div [translate]="'dossier-dictionary-dialog.title'" class="dialog-header heading-l"></div>
|
||||
<div class="dialog-header heading-l" translate="dossier-dictionary-dialog.title"></div>
|
||||
|
||||
<form (submit)="saveDossierDictionary()">
|
||||
<div class="dialog-content">
|
||||
@ -22,9 +22,9 @@
|
||||
</button>
|
||||
|
||||
<div
|
||||
[translate]="'dossier-dictionary-dialog.cancel'"
|
||||
class="all-caps-label pointer cancel"
|
||||
mat-dialog-close
|
||||
translate="dossier-dictionary-dialog.cancel"
|
||||
></div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<section class="dialog">
|
||||
<form (submit)="handleForceRedaction()" [formGroup]="redactionForm">
|
||||
<div
|
||||
[translate]="'manual-annotation.dialog.header.force'"
|
||||
class="dialog-header heading-l"
|
||||
translate="manual-annotation.dialog.header.force"
|
||||
></div>
|
||||
|
||||
<div class="dialog-content">
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<section class="dialog">
|
||||
<div [translate]="'assign-dossier-owner.dialog.title'" class="dialog-header heading-l"></div>
|
||||
<div class="dialog-header heading-l" translate="assign-dossier-owner.dialog.title"></div>
|
||||
|
||||
<div class="dialog-content no-padding-bottom">
|
||||
<redaction-team-members-manager
|
||||
@ -18,9 +18,9 @@
|
||||
</button>
|
||||
|
||||
<div
|
||||
[translate]="'assign-dossier-owner.dialog.cancel'"
|
||||
class="all-caps-label pointer cancel"
|
||||
mat-dialog-close
|
||||
translate="assign-dossier-owner.dialog.cancel"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
></redaction-popup-filter>
|
||||
<redaction-input-with-action
|
||||
[form]="searchForm"
|
||||
[placeholder]="'dossier-listing.search'"
|
||||
placeholder="dossier-listing.search"
|
||||
type="search"
|
||||
></redaction-input-with-action>
|
||||
<div
|
||||
|
||||
@ -292,7 +292,7 @@ export class DossierListingScreenComponent
|
||||
allDistinctNeedsWork.forEach(type => {
|
||||
needsWorkFilters.push({
|
||||
key: type,
|
||||
label: this._translateService.instant('filter.' + type)
|
||||
label: `filter.${type}`
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
<redaction-input-with-action
|
||||
[form]="searchForm"
|
||||
[placeholder]="'dossier-overview.search'"
|
||||
placeholder="dossier-overview.search"
|
||||
type="search"
|
||||
></redaction-input-with-action>
|
||||
|
||||
|
||||
@ -401,7 +401,7 @@ export class DossierOverviewScreenComponent
|
||||
allDistinctNeedsWork.forEach(type => {
|
||||
needsWorkFilters.push({
|
||||
key: type,
|
||||
label: this._translateService.instant('filter.' + type)
|
||||
label: `filter.${type}`
|
||||
});
|
||||
});
|
||||
needsWorkFilters.sort(
|
||||
@ -415,14 +415,11 @@ export class DossierOverviewScreenComponent
|
||||
private _computeQuickFilters() {
|
||||
if (this.allEntities.filter(this.recentlyModifiedChecker).length > 0) {
|
||||
const recentPeriodInHours = this._appConfigService.getConfig('RECENT_PERIOD_IN_HOURS');
|
||||
const recentButtonText = this._translateService.instant(
|
||||
'dossier-overview.quick-filters.recent',
|
||||
{ hours: recentPeriodInHours }
|
||||
);
|
||||
this.quickFilters = [
|
||||
{
|
||||
key: this.user.id,
|
||||
label: recentButtonText,
|
||||
label: 'dossier-overview.quick-filters.recent',
|
||||
labelParams: { hours: recentPeriodInHours },
|
||||
required: true,
|
||||
checker: this.recentlyModifiedChecker
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
export interface FilterModel {
|
||||
key: string;
|
||||
label?: string;
|
||||
labelParams?: object;
|
||||
icon?: string;
|
||||
checked?: boolean;
|
||||
indeterminate?: boolean;
|
||||
|
||||
@ -25,23 +25,23 @@
|
||||
<div class="actions">
|
||||
<div
|
||||
(click)="activateAllFilters(); $event.stopPropagation()"
|
||||
[translate]="'actions.all'"
|
||||
class="all-caps-label primary pointer"
|
||||
translate="actions.all"
|
||||
></div>
|
||||
<div
|
||||
(click)="deactivateAllFilters(); $event.stopPropagation()"
|
||||
[translate]="'actions.none'"
|
||||
class="all-caps-label primary pointer"
|
||||
translate="actions.none"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngFor="let filter of primaryFilters">
|
||||
<ng-template
|
||||
[ngTemplateOutlet]="defaultFilterTemplate"
|
||||
[ngTemplateOutletContext]="{
|
||||
filter: filter,
|
||||
atLeastOneIsExpandable: atLeastOneFilterIsExpandable
|
||||
}"
|
||||
[ngTemplateOutlet]="defaultFilterTemplate"
|
||||
></ng-template>
|
||||
</div>
|
||||
<div *ngIf="secondaryFilters?.length > 0" class="filter-options">
|
||||
@ -50,11 +50,11 @@
|
||||
</div>
|
||||
<div *ngFor="let filter of secondaryFilters">
|
||||
<ng-template
|
||||
[ngTemplateOutlet]="defaultFilterTemplate"
|
||||
[ngTemplateOutletContext]="{
|
||||
filter: filter,
|
||||
atLeastOneIsExpandable: atLeastOneSecondaryFilterIsExpandable
|
||||
}"
|
||||
[ngTemplateOutlet]="defaultFilterTemplate"
|
||||
></ng-template>
|
||||
</div>
|
||||
</div>
|
||||
@ -89,13 +89,13 @@
|
||||
class="filter-menu-checkbox"
|
||||
>
|
||||
<ng-template
|
||||
[ngTemplateOutlet]="filterTemplate ? filterTemplate : defaultFilterLabelTemplate"
|
||||
[ngTemplateOutletContext]="{ filter: filter }"
|
||||
[ngTemplateOutlet]="filterTemplate ? filterTemplate : defaultFilterLabelTemplate"
|
||||
></ng-template>
|
||||
</mat-checkbox>
|
||||
<ng-template
|
||||
[ngTemplateOutlet]="actionsTemplate ? actionsTemplate : null"
|
||||
[ngTemplateOutletContext]="{ filter: filter }"
|
||||
[ngTemplateOutlet]="actionsTemplate ? actionsTemplate : null"
|
||||
></ng-template>
|
||||
</div>
|
||||
<div *ngIf="_(filter).filters?.length && _(filter).expanded">
|
||||
@ -109,15 +109,15 @@
|
||||
[checked]="subFilter.checked"
|
||||
>
|
||||
<ng-template
|
||||
[ngTemplateOutletContext]="{ filter: subFilter }"
|
||||
[ngTemplateOutlet]="
|
||||
filterTemplate ? filterTemplate : defaultFilterLabelTemplate
|
||||
"
|
||||
[ngTemplateOutletContext]="{ filter: subFilter }"
|
||||
></ng-template>
|
||||
</mat-checkbox>
|
||||
<ng-template
|
||||
[ngTemplateOutlet]="actionsTemplate ? actionsTemplate : null"
|
||||
[ngTemplateOutletContext]="{ filter: subFilter }"
|
||||
[ngTemplateOutlet]="actionsTemplate ? actionsTemplate : null"
|
||||
></ng-template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -4,5 +4,5 @@
|
||||
[class.active]="filter.checked"
|
||||
class="quick-filter"
|
||||
>
|
||||
{{ filter.label | translate }}
|
||||
{{ filter.label | translate: filter.labelParams }}
|
||||
</div>
|
||||
|
||||
@ -3,13 +3,13 @@
|
||||
<div class="actions">
|
||||
<div
|
||||
(click)="selectAll($event)"
|
||||
[translate]="'actions.all'"
|
||||
class="all-caps-label primary pointer"
|
||||
translate="actions.all"
|
||||
></div>
|
||||
<div
|
||||
(click)="deselectAll($event)"
|
||||
[translate]="'actions.none'"
|
||||
class="all-caps-label primary pointer"
|
||||
translate="actions.none"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -52,6 +52,10 @@ export class ConfirmationDialogComponent {
|
||||
this.translate(this._inputLabelKey) + ` '${this.config.confirmationText}'`;
|
||||
}
|
||||
|
||||
get isDeleteAction() {
|
||||
return this.config?.titleColor === TitleColors.PRIMARY;
|
||||
}
|
||||
|
||||
@HostListener('window:keyup.enter')
|
||||
onKeyupEnter() {
|
||||
if (this.config.requireInput && !this.confirmationDoesNotMatch()) {
|
||||
@ -59,10 +63,6 @@ export class ConfirmationDialogComponent {
|
||||
}
|
||||
}
|
||||
|
||||
get isDeleteAction() {
|
||||
return this.config?.titleColor === TitleColors.PRIMARY;
|
||||
}
|
||||
|
||||
confirmationDoesNotMatch(): boolean {
|
||||
return this.inputValue.toLowerCase() !== this.config.confirmationText.toLowerCase();
|
||||
}
|
||||
@ -76,10 +76,14 @@ export class ConfirmationDialogComponent {
|
||||
}
|
||||
|
||||
translate<T extends ConfirmationDialogInput | string>(obj: T): T {
|
||||
const translateKeys = ['title', 'question', 'details', 'confirmationText', 'denyText'];
|
||||
|
||||
if (typeof obj === 'string')
|
||||
return this._translateService.instant(obj, this.config.translateParams);
|
||||
|
||||
const stringKeys = Object.keys(obj).filter(key => typeof key === 'string' && !!obj[key]);
|
||||
const stringKeys = Object.keys(obj).filter(
|
||||
key => typeof key === 'string' && !!obj[key] && translateKeys.includes(key)
|
||||
);
|
||||
stringKeys.forEach(key => (obj[key] = this.translate(obj[key])));
|
||||
|
||||
return obj;
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
import { MissingTranslationHandler, MissingTranslationHandlerParams } from '@ngx-translate/core';
|
||||
|
||||
export class REDMissingTranslationHandler implements MissingTranslationHandler {
|
||||
handle(params: MissingTranslationHandlerParams): any {
|
||||
const missingKey = params.key;
|
||||
console.error('Missing translation: ' + missingKey);
|
||||
return missingKey;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
0
package-lock.json
generated
0
package-lock.json
generated
Loading…
x
Reference in New Issue
Block a user