From e7bd5765b8761c212ad7920fb5ea5686c3ebc226 Mon Sep 17 00:00:00 2001 From: Michael Bromley Date: Thu, 2 Dec 2021 08:52:51 +0100 Subject: [PATCH] feat(admin-ui-plugin): Support for defaultLocale Relates to #1196 --- packages/admin-ui-plugin/src/constants.ts | 1 + packages/admin-ui-plugin/src/plugin.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/admin-ui-plugin/src/constants.ts b/packages/admin-ui-plugin/src/constants.ts index 1c2d9bc6f3..509cd2c903 100644 --- a/packages/admin-ui-plugin/src/constants.ts +++ b/packages/admin-ui-plugin/src/constants.ts @@ -4,6 +4,7 @@ import path from 'path'; export const DEFAULT_APP_PATH = path.join(__dirname, '../admin-ui'); export const loggerCtx = 'AdminUiPlugin'; export const defaultLanguage = LanguageCode.en; +export const defaultLocale = undefined; export const defaultAvailableLanguages = [ LanguageCode.de, diff --git a/packages/admin-ui-plugin/src/plugin.ts b/packages/admin-ui-plugin/src/plugin.ts index f2a64785c0..1bd999332b 100644 --- a/packages/admin-ui-plugin/src/plugin.ts +++ b/packages/admin-ui-plugin/src/plugin.ts @@ -19,7 +19,13 @@ import express from 'express'; import fs from 'fs-extra'; import path from 'path'; -import { defaultAvailableLanguages, defaultLanguage, DEFAULT_APP_PATH, loggerCtx } from './constants'; +import { + defaultAvailableLanguages, + defaultLanguage, + defaultLocale, + DEFAULT_APP_PATH, + loggerCtx, +} from './constants'; /** * @description @@ -227,6 +233,7 @@ export class AdminUiPlugin implements NestModule { authOptions.authTokenHeaderKey || DEFAULT_AUTH_TOKEN_HEADER_KEY, ), defaultLanguage: propOrDefault('defaultLanguage', defaultLanguage), + defaultLocale: propOrDefault('defaultLocale', defaultLocale), availableLanguages: propOrDefault('availableLanguages', defaultAvailableLanguages), loginUrl: AdminUiPlugin.options.adminUiConfig?.loginUrl, brand: AdminUiPlugin.options.adminUiConfig?.brand,