diff --git a/packages/console/src/i18n/init.ts b/packages/console/src/i18n/init.ts index c62d03d68..2fc8a105e 100644 --- a/packages/console/src/i18n/init.ts +++ b/packages/console/src/i18n/init.ts @@ -1,4 +1,5 @@ import resources, { Language } from '@logto/phrases'; +import { conditional } from '@silverhand/essentials'; import i18next from 'i18next'; import LanguageDetector from 'i18next-browser-languagedetector'; import { initReactI18next } from 'react-i18next'; @@ -13,11 +14,11 @@ const initI18n = async (language?: Language) => interpolation: { escapeValue: false, }, - lng: language, detection: { lookupLocalStorage: 'i18nextLogtoAcLng', lookupSessionStorage: 'i18nextLogtoAcLng', }, + ...conditional(language && { lng: language }), }); export default initI18n;