From 6b38b86a85a3eb64206f9c1b5b7e3c73f23195fa Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Sun, 20 Nov 2022 00:44:59 +0200 Subject: [PATCH] RED-5485: allow runtime i18n init --- apps/red-ui/src/app/app.module.ts | 2 +- apps/red-ui/src/assets/config/config.json | 3 +- libs/common-ui | 2 +- libs/red-domain/src/lib/shared/app-config.ts | 34 ++++++++------------ 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/apps/red-ui/src/app/app.module.ts b/apps/red-ui/src/app/app.module.ts index 713f2b85a..b37e5a398 100644 --- a/apps/red-ui/src/app/app.module.ts +++ b/apps/red-ui/src/app/app.module.ts @@ -93,7 +93,7 @@ export const appModuleFactory = (config: AppConfig) => { preventDuplicates: true, resetTimeoutOnDuplicate: true, }), - IqserTranslateModule.forRoot(), + IqserTranslateModule.forRoot({ pathPrefix: config.BASE_TRANSLATIONS_DIRECTORY }), IqserLoadingModule.forRoot(), IqserPermissionsModule.forRoot(), ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }), diff --git a/apps/red-ui/src/assets/config/config.json b/apps/red-ui/src/assets/config/config.json index 68c55ea3c..7e1aae8bc 100644 --- a/apps/red-ui/src/assets/config/config.json +++ b/apps/red-ui/src/assets/config/config.json @@ -17,5 +17,6 @@ "MANUAL_BASE_URL": "https://docs.redactmanager.com/preview", "RSS_ENABLED": true, "ANNOTATIONS_THRESHOLD": 1000, - "THEME": "theme-template" + "THEME": "theme-template", + "BASE_TRANSLATIONS_DIRECTORY": "/assets/i18n/" } diff --git a/libs/common-ui b/libs/common-ui index d11abf9de..df2f052a8 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit d11abf9de5706b4d2189bb04beda0a1f5b46fae8 +Subproject commit df2f052a8323afddb478f7ded960a46f58b65042 diff --git a/libs/red-domain/src/lib/shared/app-config.ts b/libs/red-domain/src/lib/shared/app-config.ts index 3e31478ac..3ebb0c1d1 100644 --- a/libs/red-domain/src/lib/shared/app-config.ts +++ b/libs/red-domain/src/lib/shared/app-config.ts @@ -1,21 +1,15 @@ -export interface AppConfig { - ADMIN_CONTACT_NAME: string; - ADMIN_CONTACT_URL: string; - API_URL: string; - APP_NAME: string; - AUTO_READ_TIME: number; - BACKEND_APP_VERSION: string; - EULA_URL: string; - FRONTEND_APP_VERSION: string; - MAX_FILE_SIZE_MB: number; - MAX_RETRIES_ON_SERVER_ERROR: number; - OAUTH_CLIENT_ID: string; - OAUTH_IDP_HINT: null; - OAUTH_URL: string; - RECENT_PERIOD_IN_HOURS: number; - SELECTION_MODE: string; - MANUAL_BASE_URL: string; - RSS_ENABLED: boolean; - ANNOTATIONS_THRESHOLD: number; - THEME: string; +import { IqserAppConfig } from '@iqser/common-ui'; + +export interface AppConfig extends IqserAppConfig { + readonly ADMIN_CONTACT_NAME: string; + readonly ADMIN_CONTACT_URL: string; + readonly AUTO_READ_TIME: number; + readonly BACKEND_APP_VERSION: string; + readonly EULA_URL: string; + readonly MAX_FILE_SIZE_MB: number; + readonly MAX_RETRIES_ON_SERVER_ERROR: number; + readonly RECENT_PERIOD_IN_HOURS: number; + readonly SELECTION_MODE: string; + readonly ANNOTATIONS_THRESHOLD: number; + readonly THEME: string; }