diff --git a/apps/red-ui/src/app/components/base-screen/base-screen.component.ts b/apps/red-ui/src/app/components/base-screen/base-screen.component.ts index bb3359453..e5b07abdc 100644 --- a/apps/red-ui/src/app/components/base-screen/base-screen.component.ts +++ b/apps/red-ui/src/app/components/base-screen/base-screen.component.ts @@ -7,6 +7,7 @@ import { Router } from '@angular/router'; import { Title } from '@angular/platform-browser'; import { FileDownloadService } from '@upload-download/services/file-download.service'; import { TranslateService } from '@ngx-translate/core'; +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; interface MenuItem { name: string; @@ -22,23 +23,23 @@ interface MenuItem { export class BaseScreenComponent { readonly userMenuItems: MenuItem[] = [ { - name: 'top-bar.navigation-items.my-account.children.my-profile', + name: _('top-bar.navigation-items.my-account.children.my-profile'), routerLink: '/main/my-profile', show: true }, { - name: 'top-bar.navigation-items.my-account.children.admin', + name: _('top-bar.navigation-items.my-account.children.admin'), routerLink: '/main/admin', show: this.permissionsService.isManager() || this.permissionsService.isUserAdmin(), action: this.appStateService.reset }, { - name: 'top-bar.navigation-items.my-account.children.downloads', + name: _('top-bar.navigation-items.my-account.children.downloads'), routerLink: '/main/downloads', show: this.permissionsService.isUser() }, { - name: 'top-bar.navigation-items.my-account.children.trash', + name: _('top-bar.navigation-items.my-account.children.trash'), routerLink: '/main/admin/trash', show: this.permissionsService.isManager() || this.permissionsService.isUserAdmin() } diff --git a/apps/red-ui/src/app/modules/admin/admin-side-nav/admin-side-nav.component.html b/apps/red-ui/src/app/modules/admin/admin-side-nav/admin-side-nav.component.html index a4d370d76..65bbc2a89 100644 --- a/apps/red-ui/src/app/modules/admin/admin-side-nav/admin-side-nav.component.html +++ b/apps/red-ui/src/app/modules/admin/admin-side-nav/admin-side-nav.component.html @@ -12,7 +12,7 @@ class="item" routerLinkActive="active" > - {{ item.label || item.screen | translate }} + {{ item.label | translate }} diff --git a/apps/red-ui/src/app/modules/admin/admin-side-nav/admin-side-nav.component.ts b/apps/red-ui/src/app/modules/admin/admin-side-nav/admin-side-nav.component.ts index 13dbb85c0..418fb71b4 100644 --- a/apps/red-ui/src/app/modules/admin/admin-side-nav/admin-side-nav.component.ts +++ b/apps/red-ui/src/app/modules/admin/admin-side-nav/admin-side-nav.component.ts @@ -2,6 +2,7 @@ import { Component, Input } from '@angular/core'; import { PermissionsService } from '@services/permissions.service'; import { UserPreferenceService } from '@services/user-preference.service'; import { AppStateService } from '@state/app-state.service'; +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; @Component({ selector: 'redaction-admin-side-nav', @@ -18,25 +19,25 @@ export class AdminSideNavComponent { onlyAdmin?: boolean; onlyManager?: boolean; userManagerOnly?: boolean; - label?: string; + label: string; }[]; } = { settings: [ - { screen: 'dossier-templates', onlyManager: true }, - { screen: 'digital-signature', onlyAdmin: true }, - { screen: 'license-info', label: 'license-information', onlyAdmin: true }, - { screen: 'audit', onlyAdmin: true }, - { screen: 'users', label: 'user-management', userManagerOnly: true }, - { screen: 'smtp-config', label: 'configurations', onlyAdmin: true } + { screen: 'dossier-templates', label: _('dossier-templates'), onlyManager: true }, + { screen: 'digital-signature', label: _('digital-signature'), onlyAdmin: true }, + { screen: 'license-info', label: _('license-information'), onlyAdmin: true }, + { screen: 'audit', label: _('audit'), onlyAdmin: true }, + { screen: 'users', label: _('user-management'), userManagerOnly: true }, + { screen: 'smtp-config', label: _('configurations'), onlyAdmin: true } ], 'dossier-templates': [ - { screen: 'dictionaries' }, - { screen: 'rules', onlyDevMode: true, label: 'rule-editor' }, - { screen: 'default-colors' }, - { screen: 'watermark' }, - { screen: 'file-attributes' }, - { screen: 'dossier-attributes' }, - { screen: 'reports', onlyDevMode: true } + { screen: 'dictionaries', label: _('dictionaries') }, + { screen: 'rules', onlyDevMode: true, label: _('rule-editor') }, + { screen: 'default-colors', label: _('default-colors') }, + { screen: 'watermark', label: _('watermark') }, + { screen: 'file-attributes', label: _('file-attributes') }, + { screen: 'dossier-attributes', label: _('dossier-attributes') }, + { screen: 'reports', label: _('reports'), onlyDevMode: true } ] }; diff --git a/apps/red-ui/src/app/modules/admin/components/users-stats/users-stats.component.html b/apps/red-ui/src/app/modules/admin/components/users-stats/users-stats.component.html index d3e45d454..88d0709fb 100644 --- a/apps/red-ui/src/app/modules/admin/components/users-stats/users-stats.component.html +++ b/apps/red-ui/src/app/modules/admin/components/users-stats/users-stats.component.html @@ -23,7 +23,7 @@ [config]="chartData" [radius]="63" [strokeWidth]="15" - [subtitle]="'user-stats.chart.users'" + [subtitle]="'user-stats.chart.users' | translate" direction="row" totalType="sum" > diff --git a/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.html index b33a0b768..b921d38b3 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.html @@ -163,7 +163,7 @@ [counterText]="'dictionary-listing.stats.charts.entries' | translate" [radius]="82" [strokeWidth]="15" - [subtitle]="'dictionary-listing.stats.charts.types'" + [subtitle]="'dictionary-listing.stats.charts.types' | translate" totalType="count" > diff --git a/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen.component.ts index ac29cfe69..21dd63d9b 100644 --- a/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen.component.ts @@ -11,6 +11,7 @@ import { Toaster } from '@services/toaster.service'; import { ActivatedRoute } from '@angular/router'; import { BASE_HREF } from '../../../../tokens'; import { stampPDFPage } from '../../../../utils/page-stamper'; +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; export const DEFAULT_WATERMARK: WatermarkModelRes = { text: null, @@ -82,9 +83,11 @@ export class WatermarkScreenComponent implements OnInit { observable.toPromise().then( () => { this._loadWatermark(); - this._toaster.success(watermark.text ? 'watermark-screen.action.change-success' : 'watermark-screen.action.delete-success'); + this._toaster.success( + watermark.text ? _('watermark-screen.action.change-success') : _('watermark-screen.action.delete-success') + ); }, - () => this._toaster.error('watermark-screen.action.error') + () => this._toaster.error(_('watermark-screen.action.error')) ); } diff --git a/apps/red-ui/src/app/modules/dossier/components/dossier-details/dossier-details.component.html b/apps/red-ui/src/app/modules/dossier/components/dossier-details/dossier-details.component.html index 89394475d..c5a606aa3 100644 --- a/apps/red-ui/src/app/modules/dossier/components/dossier-details/dossier-details.component.html +++ b/apps/red-ui/src/app/modules/dossier/components/dossier-details/dossier-details.component.html @@ -45,7 +45,7 @@ [config]="documentsChartData" [radius]="63" [strokeWidth]="15" - [subtitle]="'dossier-overview.dossier-details.charts.documents-in-dossier'" + [subtitle]="'dossier-overview.dossier-details.charts.documents-in-dossier' | translate" direction="row" > diff --git a/apps/red-ui/src/app/modules/dossier/components/dossier-listing-details/dossier-listing-details.component.html b/apps/red-ui/src/app/modules/dossier/components/dossier-listing-details/dossier-listing-details.component.html index 6609a95ad..48847222d 100644 --- a/apps/red-ui/src/app/modules/dossier/components/dossier-listing-details/dossier-listing-details.component.html +++ b/apps/red-ui/src/app/modules/dossier/components/dossier-listing-details/dossier-listing-details.component.html @@ -3,7 +3,7 @@ [config]="dossiersChartData" [radius]="80" [strokeWidth]="15" - [subtitle]="'dossier-listing.stats.charts.dossiers'" + [subtitle]="'dossier-listing.stats.charts.dossiers' | translate" >
@@ -29,6 +29,6 @@ [config]="documentsChartData" [radius]="80" [strokeWidth]="15" - [subtitle]="'dossier-listing.stats.charts.total-documents'" + [subtitle]="'dossier-listing.stats.charts.total-documents' | translate" >
diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts index bef95068a..ea86e2e36 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts @@ -29,6 +29,7 @@ import { ScreenStateService } from '@shared/services/screen-state.service'; import { BaseListingComponent } from '@shared/base/base-listing.component'; import { SortingService } from '@services/sorting.service'; import { TableColConfig } from '@shared/components/table-col-name/table-col-name.component'; +import { workloadTranslations } from '../../translations/workload-translations'; const isLeavingScreen = event => event instanceof NavigationStart && event.url !== '/main/dossiers'; @@ -230,7 +231,7 @@ export class DossierListingScreenComponent const needsWorkFilters = [...allDistinctNeedsWork].map(type => ({ key: type, - label: `filter.${type}` + label: workloadTranslations[type] })); this.filterService.addFilterGroup({ diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts index 1c1cad6b2..f396f0f21 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts @@ -32,6 +32,7 @@ import { LoadingService } from '@services/loading.service'; import { DossierAttributesService } from '@shared/services/controller-wrappers/dossier-attributes.service'; import { DossierAttributeWithValue } from '@models/dossier-attributes.model'; import { UserPreferenceService } from '@services/user-preference.service'; +import { workloadTranslations } from '../../translations/workload-translations'; @Component({ templateUrl: './dossier-overview-screen.component.html', @@ -294,7 +295,7 @@ export class DossierOverviewScreenComponent const needsWorkFilters = [...allDistinctNeedsWork].map(item => ({ key: item, - label: this._translateService.instant('filter.' + item) + label: workloadTranslations[item] })); this.filterService.addFilterGroup({ diff --git a/apps/red-ui/src/app/modules/dossier/translations/workload-translations.ts b/apps/red-ui/src/app/modules/dossier/translations/workload-translations.ts new file mode 100644 index 000000000..eea3c5668 --- /dev/null +++ b/apps/red-ui/src/app/modules/dossier/translations/workload-translations.ts @@ -0,0 +1,11 @@ +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; + +export const workloadTranslations: { [key: string]: string } = { + analysis: _('filter.analysis'), + hint: _('filter.hint'), + image: _('filter.image'), + none: _('filter.none'), + redaction: _('filter.redaction'), + suggestion: _('filter.suggestion'), + updated: _('filter.updated') +}; diff --git a/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.html b/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.html index af8c784fc..09e4aa6af 100644 --- a/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.html +++ b/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.html @@ -19,7 +19,7 @@
{{ displayedDataTotal }}
-
{{ subtitle | translate }}
+
{{ subtitle }}
diff --git a/apps/red-ui/src/app/modules/shared/pipes/date.pipe.ts b/apps/red-ui/src/app/modules/shared/pipes/date.pipe.ts index fe9f71c85..6b0a34b6f 100644 --- a/apps/red-ui/src/app/modules/shared/pipes/date.pipe.ts +++ b/apps/red-ui/src/app/modules/shared/pipes/date.pipe.ts @@ -31,23 +31,17 @@ export class DatePipe extends BaseDatePipe implements PipeTransform { const minutesFromNow = date.diff(now, 'minutes'); const minutesLeft = minutesFromNow - HOURS_IN_A_DAY * MINUTES_IN_AN_HOUR * daysLeft; - if (daysLeft === 0 && hoursLeft === 0 && minutesLeft > 0) return this._translate('time.less-than-an-hour'); + if (daysLeft === 0 && hoursLeft === 0 && minutesLeft > 0) return this._translateService.instant('time.less-than-an-hour'); - const hoursSuffix = this._translate(`time.hour${hoursLeft === 1 ? '' : 's'}`); - const hoursDisplay = `${hoursLeft} ${hoursSuffix}`; + const hoursDisplay = this._translateService.instant('time.hours', { hours: hoursLeft }); if (daysLeft === 0 && hoursLeft > 0) return hoursDisplay; - const daysSuffix = this._translate(`time.day${daysLeft === 1 ? '' : 's'}`); - const daysDisplay = `${daysLeft} ${daysSuffix}`; + const daysDisplay = this._translateService.instant('time.days', { days: daysLeft }); if (daysLeft > 0 && hoursLeft > 0) return `${daysDisplay} ${hoursDisplay}`; if (daysLeft > 0) return daysDisplay; - return this._translate(`time.no-time-left`); - } - - private _translate(value: string, params?: { [key: string]: string }) { - return this._translateService.instant(value, params); + return this._translateService.instant(`time.no-time-left`); } } diff --git a/apps/red-ui/src/app/utils/missing-translations-handler.ts b/apps/red-ui/src/app/utils/missing-translations-handler.ts index b6b871c45..436d0ba02 100644 --- a/apps/red-ui/src/app/utils/missing-translations-handler.ts +++ b/apps/red-ui/src/app/utils/missing-translations-handler.ts @@ -4,6 +4,6 @@ export class REDMissingTranslationHandler implements MissingTranslationHandler { handle(params: MissingTranslationHandlerParams): any { const missingKey = params.key; console.error('Missing translation: ' + missingKey); - return missingKey; + return `?${missingKey}?`; } } diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 3319b987e..fa4c2bc2a 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -1236,21 +1236,11 @@ }, "title": "Configure SMTP Account" }, - "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", "time": { - "day": "day", - "days": "days", - "hour": "hour", - "hours": "hours", + "hours": "{hours} {hours, plural, one{hour} other{hours}}", + "days": "{days} {days, plural, one{day} other{days}}", "less-than-an-hour": "< 1 hour", "no-time-left": "Time to restore already passed" }, diff --git a/apps/red-ui/src/assets/i18n/te.json b/apps/red-ui/src/assets/i18n/te.json index b9cbf4cad..d36837b91 100644 --- a/apps/red-ui/src/assets/i18n/te.json +++ b/apps/red-ui/src/assets/i18n/te.json @@ -358,6 +358,7 @@ } }, "content": "", + "default-colors": "", "default-colors-screen": { "action": { "edit": "" @@ -382,6 +383,7 @@ } }, "dev-mode": "", + "dictionaries": "", "dictionary-listing": { "action": { "delete": "", @@ -402,7 +404,8 @@ "search": "", "stats": { "charts": { - "entries": "" + "entries": "", + "types": "" } }, "table-col-names": { @@ -474,6 +477,7 @@ "number": "", "text": "" }, + "dossier-attributes": "", "dossier-attributes-listing": { "action": { "edit": "" @@ -539,6 +543,10 @@ "search": "", "stats": { "analyzed-pages": "", + "charts": { + "dossiers": "", + "total-documents": "" + }, "total-people": "" }, "table-col-names": { @@ -567,6 +575,9 @@ "image-uploaded": "", "show-less": "" }, + "charts": { + "documents-in-dossier": "" + }, "description": "", "dictionary": "", "stats": { @@ -734,6 +745,7 @@ "number": "", "text": "" }, + "file-attributes": "", "file-attributes-csv-import": { "action": { "cancel-edit-name": "", @@ -878,6 +890,15 @@ "filter-types": "", "label": "" }, + "filter": { + "analysis": "", + "hint": "", + "image": "", + "none": "", + "redaction": "", + "suggestion": "", + "updated": "" + }, "filters": { "assigned-people": "", "dossier-templates": "", @@ -1006,6 +1027,7 @@ "report-type": { "label": "" }, + "reports": "", "reports-screen": { "description": "", "document-setup-description": "", @@ -1035,6 +1057,7 @@ "red-user-admin": "", "regular": "" }, + "rule-editor": "", "rules-screen": { "revert-changes": "", "save-changes": "" @@ -1087,18 +1110,28 @@ "subtitle": "", "title": "" }, + "time": { + "days": "", + "hours": "", + "less-than-an-hour": "", + "no-time-left": "" + }, "top-bar": { "navigation-items": { "back": "", "dossiers": "", "my-account": { "children": { + "admin": "", + "downloads": "", "language": { "de": "", "en": "", "label": "" }, - "logout": "" + "logout": "", + "my-profile": "", + "trash": "" } } } @@ -1180,12 +1213,19 @@ "title": "" }, "user-stats": { + "chart": { + "users": "" + }, "collapse": "", "expand": "", "title": "" }, + "watermark": "", "watermark-screen": { "action": { + "change-success": "", + "delete-success": "", + "error": "", "revert": "", "save": "" },