From 1f50eafee28bf2cbc9c5d2eed529505c51783c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Sat, 17 Jul 2021 00:53:54 +0300 Subject: [PATCH] Prepare for pluralization --- apps/red-ui/src/app/app.module.ts | 22 ++-- apps/red-ui/src/assets/i18n/en.json | 160 ++++++++++++++-------------- apps/red-ui/src/assets/i18n/te.json | 2 + 3 files changed, 90 insertions(+), 94 deletions(-) diff --git a/apps/red-ui/src/app/app.module.ts b/apps/red-ui/src/app/app.module.ts index 987f7f9d1..3fa8395fb 100644 --- a/apps/red-ui/src/app/app.module.ts +++ b/apps/red-ui/src/app/app.module.ts @@ -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 { MissingTranslationHandler, TranslateLoader, TranslateModule } from '@ngx-translate/core'; +import { MissingTranslationHandler, TranslateCompiler, 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'; @@ -30,6 +30,7 @@ import { BASE_HREF } from './tokens'; import { MONACO_PATH, MonacoEditorModule } from '@materia-ui/ngx-monaco-editor'; import { GlobalErrorHandler } from '@utils/global-error-handler.service'; import { REDMissingTranslationHandler } from '@utils/missing-translations-handler'; +import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler'; export function httpLoaderFactory(httpClient: HttpClient) { return new TranslateHttpLoader(httpClient, '/assets/i18n/', '.json'); @@ -47,14 +48,7 @@ function cleanupBaseUrl(baseUrl: string) { const screens = [BaseScreenComponent, DownloadsListScreenComponent, UserProfileScreenComponent]; -const components = [ - AppComponent, - LogoComponent, - AuthErrorComponent, - ToastComponent, - NotificationsComponent, - ...screens -]; +const components = [AppComponent, LogoComponent, AuthErrorComponent, ToastComponent, NotificationsComponent, ...screens]; @NgModule({ declarations: [...components], @@ -78,6 +72,10 @@ const components = [ provide: TranslateLoader, useFactory: httpLoaderFactory, deps: [HttpClient] + }, + compiler: { + provide: TranslateCompiler, + useClass: TranslateMessageFormatCompiler } }), ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }) @@ -126,11 +124,7 @@ export class AppModule { private _configureKeyCloakRouteHandling() { this._route.queryParamMap.subscribe(queryParams => { - if ( - queryParams.has('code') || - queryParams.has('state') || - queryParams.has('session_state') - ) { + if (queryParams.has('code') || queryParams.has('state') || queryParams.has('session_state')) { this._router.navigate([], { queryParams: { state: null, diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index cb33e9c3d..2f6041703 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -51,7 +51,7 @@ }, "save": "Save Dictionary", "title": { - "edit": "Edit {{name}} Dictionary", + "edit": "Edit {name} Dictionary", "new": "Create Dictionary" } }, @@ -66,7 +66,7 @@ }, "save": "Save Dossier Template", "title": { - "edit": "Edit {{name}} Dossier Template", + "edit": "Edit {name} Dossier Template", "new": "Create Dossier Template" } }, @@ -82,7 +82,7 @@ }, "save": "Save Attribute", "title": { - "edit": "Edit {{name}} File Attribute", + "edit": "Edit {name} File Attribute", "new": "Add New File Attribute" } }, @@ -95,7 +95,7 @@ }, "save": "Save Attribute", "title": { - "edit": "Edit {{name}} Dossier Attribute", + "edit": "Edit {name} Dossier Attribute", "new": "Add New Dossier Attribute" }, "error": { @@ -139,78 +139,78 @@ "message": { "dictionary": { "add": { - "error": "Failed to add entry to dictionary: {{error}}", + "error": "Failed to add entry to dictionary: {error}", "success": "Entry added to dictionary. Changes will be visible after reanalysis." }, "approve": { - "error": "Failed to approve dictionary entry: {{error}}", + "error": "Failed to approve dictionary entry: {error}", "success": "Dictionary entry approved. Changes will be visible after reanalysis." }, "decline": { - "error": "Failed to decline dictionary suggestion: {{error}}", + "error": "Failed to decline dictionary suggestion: {error}", "success": "Dictionary suggestion declined." }, "remove": { - "error": "Failed to remove dictionary entry: {{error}}", + "error": "Failed to remove dictionary entry: {error}", "success": "Dictionary entry removed!" }, "request-remove": { - "error": "Failed to request removal of dictionary entry: {{error}}", + "error": "Failed to request removal of dictionary entry: {error}", "success": "Requested to remove dictionary entry!" }, "suggest": { - "error": "Failed to save suggestion for dictionary modification: {{error}}", + "error": "Failed to save suggestion for dictionary modification: {error}", "success": "Suggestion for dictionary modification saved!" }, "undo": { - "error": "Failed to undo: {{error}}", + "error": "Failed to undo: {error}", "success": "Undo successful" } }, "manual-redaction": { "add": { - "error": "Failed to save redaction: {{error}}", + "error": "Failed to save redaction: {error}", "success": "Redaction added!" }, "force-redaction": { - "error": "Failed to save redaction: {{error}}", + "error": "Failed to save redaction: {error}", "success": "Redaction added!" }, "approve": { - "error": "Failed to approve suggestion: {{error}}", + "error": "Failed to approve suggestion: {error}", "success": "Suggestion approved." }, "change-legal-basis": { - "error": "Failed to edit annotation reason: {{error}}", + "error": "Failed to edit annotation reason: {error}", "success": "Annotation reason was edited." }, "decline": { - "error": "Failed to decline suggestion: {{error}}", + "error": "Failed to decline suggestion: {error}", "success": "Suggestion declined." }, "request-change-legal-basis": { - "error": "Failed to request annotation reason change: {{error}}", + "error": "Failed to request annotation reason change: {error}", "success": "Annotation reason change requested." }, "recategorize-image": { - "error": "Failed to recategorize image: {{error}}", + "error": "Failed to recategorize image: {error}", "success": "Image recategorized." }, "request-image-recategorization": { - "error": "Failed to request image recategorization: {{error}}", + "error": "Failed to request image recategorization: {error}", "success": "Image recategorization requested." }, "search": "Document name...", "suggest": { - "error": "Failed to save redaction suggestion: {{error}}", + "error": "Failed to save redaction suggestion: {error}", "success": "Redaction suggestion saved" }, "request-force-redaction": { - "error": "Failed to save redaction suggestion: {{error}}", + "error": "Failed to save redaction suggestion: {error}", "success": "Redaction suggestion saved" }, "undo": { - "error": "Failed to undo: {{error}}", + "error": "Failed to undo: {error}", "success": "Undo successful" } } @@ -311,15 +311,15 @@ "user": "User" }, "table-header": { - "title": "{{length}} Logs" + "title": "{length} Logs" }, "to": "to" }, "auth-error": { "heading": "Your user doesn't have the required RED-* roles to access this application. Please contact your admin for access!", - "heading-with-link": "Your user doesn't have the required RED-* roles to access this application. Please contact your admin for access!", - "heading-with-name": "Your user doesn't have the required RED-* roles to access this application. Please contact {{adminName}} for access!", - "heading-with-name-and-link": "Your user doesn't have the required RED-* roles to access this application. Please contact {{adminName}} for access!", + "heading-with-link": "Your user doesn't have the required RED-* roles to access this application. Please contact your admin for access!", + "heading-with-name": "Your user doesn't have the required RED-* roles to access this application. Please contact {adminName} for access!", + "heading-with-name-and-link": "Your user doesn't have the required RED-* roles to access this application. Please contact {adminName} for access!", "logout": "Logout" }, "by": "by", @@ -356,7 +356,7 @@ } }, "reset-password-dialog": { - "header": "Set Temporary Password for {{userName}}", + "header": "Set Temporary Password for {userName}", "form": { "password": "Temporary password" }, @@ -369,8 +369,8 @@ "comments": { "add-comment": "Enter comment", "cancel": "Cancel", - "comment": "{{count}} comment", - "comments": "{{count}} comments", + "comment": "{count} comment", + "comments": "{count} comments", "hide-comments": "Hide comments" }, "common": { @@ -399,7 +399,7 @@ "lost-details": "All inputted details on the documents will be lost", "title": { "bulk": "Delete File Attributes", - "single": "Delete {{name}}" + "single": "Delete {name}" }, "toast-error": "Please confirm that you understand the ramifications of your action!", "warning": "Warning: this cannot be undone!" @@ -417,7 +417,7 @@ "bulk": "All documents pending review from the users will be impacted", "single": "All documents pending review from the user will be impacted" }, - "impacted-dossiers": "{{dossiersCount}} dossiers will be impacted", + "impacted-dossiers": "{dossiersCount} dossiers will be impacted", "title": { "bulk": "Delete Users from Workspace", "single": "Delete User from Workspace" @@ -431,16 +431,16 @@ "title": "Re-assign reviewer" }, "compare-file": { - "question": "Warning!

Number of pages does not match, current document has {{currentDocumentPageCount}} page(s). Uploaded document has {{compareDocumentPageCount}} page(s).

Do you wish to proceed?", - "title": "Compare with file: {{fileName}}" + "question": "Warning!

Number of pages does not match, current document has {currentDocumentPageCount} page(s). Uploaded document has {compareDocumentPageCount} page(s).

Do you wish to proceed?", + "title": "Compare with file: {fileName}" }, "delete-dossier": { "confirmation-text": "Delete Dossier", "deny-text": "Keep Dossier", - "details": "Deleted dossiers are sent to trash. They can be restored up to {{period}} days from their deletion.", + "details": "Deleted dossiers are sent to trash. They can be restored up to {period} days from their deletion.", "input-label": "To proceed please type below", "question": "Are you sure you want to delete this dossier?", - "title": "Delete {{dossierName}}" + "title": "Delete {dossierName}" }, "delete-file": { "question": "Do you wish to proceed?", @@ -458,7 +458,7 @@ "key": "Type" }, "table-header": { - "title": "{{length}} Default Colors" + "title": "{length} Default Colors" }, "types": { "analysisColor": "Analysis", @@ -506,7 +506,7 @@ "type": "Type" }, "table-header": { - "title": "{{length}} dictionaries" + "title": "{length} dictionaries" } }, "dictionary-overview": { @@ -595,7 +595,7 @@ "add-new": "New Dossier", "delete": { "action": "Delete Dossier", - "delete-failed": "Failed to delete dossier: {{dossierName}}" + "delete-failed": "Failed to delete dossier: {dossierName}" }, "download-files": { "action": "Download Redacted Files" @@ -637,7 +637,7 @@ }, "table-header": { "recent": "Recent", - "title": "{{length}} active dossiers" + "title": "{length} active dossiers" } }, "dossier-member-guard": { @@ -659,7 +659,7 @@ "dossier-details": { "attributes": { "image-uploaded": "Image uploaded", - "expand": "{{count}} custom attributes", + "expand": "{count} custom attributes", "show-less": "show less" }, "charts": { @@ -668,11 +668,11 @@ "description": "Description", "dictionary": "Dossier Dictionary", "stats": { - "analysed-pages": "{{count}} pages", - "created-on": "Created on {{date}}", - "documents": "{{count}} documents", - "due-date": "Due {{date}}", - "people": "{{count}} user(s)" + "analysed-pages": "{count} pages", + "created-on": "Created on {date}", + "documents": "{count} documents", + "due-date": "Due {date}", + "people": "{count} user(s)" } }, "download-file": "Download", @@ -708,7 +708,7 @@ "quick-filters": { "assigned-to-me": "Assigned to me", "assigned-to-others": "Assigned to others", - "recent": "Recent ({{hours}} h)", + "recent": "Recent ({hours} h)", "unassigned": "Unassigned" }, "reanalyse": { @@ -728,7 +728,7 @@ "status": "Status" }, "table-header": { - "title": "{{length}} documents" + "title": "{length} documents" }, "under-approval": "For Approval", "under-review": "Under Review", @@ -744,7 +744,7 @@ "bulk": { "delete": "Delete Selected Dossier Templates" }, - "dictionaries": "{{length}} dictionaries", + "dictionaries": "{length} dictionaries", "no-data": { "title": "There are no dossier templates yet." }, @@ -759,15 +759,15 @@ "name": "Name" }, "table-header": { - "title": "{{length}} dossier templates" + "title": "{length} dossier templates" } }, "download-includes": "Choose what is included at download:", "download-status": { - "queued": "Your download has been queued, you can see all your requested downloads here: My Downloads ." + "queued": "Your download has been queued, you can see all your requested downloads here: My Downloads ." }, "download-type": { - "label": "{{length}} document versions", + "label": "{length} document versions", "ORIGINAL": "Optimized PDF", "PREVIEW": "Preview PDF", "REDACTED": "Redacted PDF" @@ -788,7 +788,7 @@ "type": "Type" }, "table-header": { - "title": "{{length}} downloads" + "title": "{length} downloads" } }, "edit-color-dialog": { @@ -798,7 +798,7 @@ "color-placeholder": "Color" }, "save": "Save", - "success": "Successfully updated color for {{color}}." + "success": "Successfully updated color for {color}." }, "edit-dossier-dialog": { "actions": { @@ -808,7 +808,7 @@ "change-successful": "Dossier was updated.", "delete-successful": "Dossier was deleted.", "dictionary": { - "entries": "{{length}} entries" + "entries": "{length} entries" }, "general-info": { "form": { @@ -825,7 +825,7 @@ "watermark": "Watermark application on redacted documents" } }, - "header": "Edit {{dossierName}}", + "header": "Edit {dossierName}", "nav-items": { "choose-download": "Choose what is included at download:", "dictionary": "Dictionary", @@ -870,7 +870,7 @@ "remove": "Remove", "save-name": "Save" }, - "available": "{{value}} available", + "available": "{value} available", "cancel": "Cancel", "csv-column": "CSV Column", "delimiter": "Delimiter", @@ -884,7 +884,7 @@ "title": "No file attributes defined. Select a column from the left panel to start defining file attributes." }, "no-hovered-column": "Preview CSV column by hovering the entry.", - "no-sample-data-for": "No sample data for {{column}}.", + "no-sample-data-for": "No sample data for {column}.", "parse-csv": "Parse CSV with new options", "quick-activation": { "all": "All", @@ -893,12 +893,12 @@ "save": { "error": "Failed to create File Attributes!", "label": "Save Attributes", - "success": "{{count}} File Attributes created successfully!" + "success": "{count} File Attributes created successfully!" }, "search": { "placeholder": "Search by column name..." }, - "selected": "{{value}} selected", + "selected": "{value} selected", "table-col-names": { "name": "Name", "primary": "primary", @@ -914,10 +914,10 @@ "remove-selected": "Remove Selected", "type": "Type" }, - "title": "{{length}} file attributes" + "title": "{length} file attributes" }, "title": "Select CSV columns to use as File Attributes", - "total-rows": "{{rows}} rows in total" + "total-rows": "{rows} rows in total" }, "file-attributes-listing": { "action": { @@ -945,7 +945,7 @@ "type": "Input Type" }, "table-header": { - "title": "{{length}} file attributes" + "title": "{length} file attributes" }, "upload-csv": "Upload File Attributes Configuration" }, @@ -973,7 +973,7 @@ "type": "Type" }, "table-header": { - "title": "{{length}} dossier attributes" + "title": "{length} dossier attributes" } }, "file-preview": { @@ -1017,10 +1017,10 @@ "document-info": { "close": "Close Document Info", "details": { - "created-on": "Created on: {{date}}", - "dossier": "in {{dossierName}}", - "due": "Due: {{date}}", - "pages": "{{pages}} pages" + "created-on": "Created on: {date}", + "dossier": "in {dossierName}", + "due": "Due: {date}", + "pages": "{pages} pages" }, "edit": "Edit Document Info", "label": "Document Info" @@ -1087,16 +1087,16 @@ "pages-per-month": "Pages per Month", "total-pages": "Total Pages" }, - "copyright-claim-text": "Copyright © 2020 - {{currentYear}} knecon AG (powered by IQSER)", + "copyright-claim-text": "Copyright © 2020 - {currentYear} knecon AG (powered by IQSER)", "copyright-claim-title": "Copyright Claim", "current-analyzed": "Analyzed Pages in Current Licensing Period", "custom-app-title": "Custom Application Title", "email": { "body": { - "analyzed": "Total Analyzed Pages in current license period: {{pages}}.", - "licensed": "Licensed Pages: {{pages}}." + "analyzed": "Total Analyzed Pages in current license period: {pages}.", + "licensed": "Licensed Pages: {pages}." }, - "title": "License Report {{licenseCustomer}}" + "title": "License Report {licenseCustomer}" }, "email-report": "Email Report", "end-user-license-text": "The use of this product is subject to the terms of the Redaction End User Agreement, unless other specified therein.", @@ -1106,7 +1106,7 @@ "licensed-to": "Licensed to", "licensing-details": "Licensing Details", "licensing-period": "Licensing Period", - "total-analyzed": "Total Analyzed Pages Since {{date}}", + "total-analyzed": "Total Analyzed Pages Since {date}", "unlicensed-analyzed": "Unlicensed Analyzed Pages", "usage-details": "Usage Details" }, @@ -1155,7 +1155,7 @@ "remember": "Remember choice and don't ask me again", "skip": "Keep existing document" }, - "question": "{{filename}} already exists. Choose how to proceed:", + "question": "{filename} already exists. Choose how to proceed:", "title": "Document already exists!" }, "page": "Page", @@ -1179,7 +1179,7 @@ "confirm": "Yes, proceed and remove!", "deny": "Cancel", "dictionary": "Dictionary", - "image-type": "Image: {{typeLabel}}", + "image-type": "Image: {typeLabel}", "remove-from-dictionary": { "question": "Following entries will be removed from their respective dictionaries:", "title": "Remove From Dictionary" @@ -1193,7 +1193,7 @@ "report-type": { "EXCEL_MULTI_FILE": "Excel (for all)", "EXCEL_SINGLE_FILE": "Excel (per file)", - "label": "{{length}} report types", + "label": "{length} report types", "WORD_SINGLE_FILE_APPENDIX_A1_TEMPLATE": "Justification Appendix A1", "WORD_SINGLE_FILE_APPENDIX_A2_TEMPLATE": "Justification Appendix A2" }, @@ -1286,8 +1286,8 @@ "trash": { "label": "Trash", "table-header": { - "title": "{{length}} deleted dossiers", - "info": "Deleted items can be restored up to {{hours}} hours from their deletions" + "title": "{length} deleted dossiers", + "info": "Deleted items can be restored up to {hours} hours from their deletions" }, "bulk": { "delete": "Forever Delete Selected Dossiers", @@ -1347,10 +1347,10 @@ "cancel": "Cancel Upload", "re-upload": "Retry Upload" }, - "title": "File Uploads ({{len}})" + "title": "File Uploads ({len})" }, "error": { - "file-size": "File too large. Limit is {{size}}MB.", + "file-size": "File too large. Limit is {size}MB.", "generic": "Failed to upload file. " } }, @@ -1375,7 +1375,7 @@ "roles": "Roles" }, "table-header": { - "title": "{{length}} users" + "title": "{length} users" } }, "user-management": "User Management", diff --git a/apps/red-ui/src/assets/i18n/te.json b/apps/red-ui/src/assets/i18n/te.json index 83f2574bf..706acba0d 100644 --- a/apps/red-ui/src/assets/i18n/te.json +++ b/apps/red-ui/src/assets/i18n/te.json @@ -503,6 +503,7 @@ "table-col-names": { "name": "", "primary": "", + "primary-info-tooltip": "", "read-only": "", "type": "" }, @@ -522,6 +523,7 @@ "csv-column": "", "name": "", "primary": "", + "primary-info-tooltip": "", "read-only": "", "type": "" },