From 53ef4a0579cf0218b7bccec64b2b6620c6f39fac Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Tue, 31 Oct 2023 00:21:01 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20crowdin=20live-translate=20fe?= =?UTF-8?q?ature!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next-i18next.config.js | 3 ++- src/pages/_app.tsx | 16 +++++++++---- src/pages/user/preferences.tsx | 5 ++-- src/tools/language.ts | 42 +++++++--------------------------- 4 files changed, 23 insertions(+), 43 deletions(-) diff --git a/next-i18next.config.js b/next-i18next.config.js index 779df3a63..6468aee9e 100644 --- a/next-i18next.config.js +++ b/next-i18next.config.js @@ -6,6 +6,7 @@ module.exports = { defaultLocale: 'en', locales: [ 'en', + 'cr', 'da', 'he', 'de', @@ -33,7 +34,7 @@ module.exports = { 'hu' ], - localeDetection: true, + localeDetection: false, }, returnEmptyString: false, appendNamespaceToCIMode: true, diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 7374e1950..5ff3dce20 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -61,7 +61,7 @@ function App( const analyticsEnabled = pageProps.analyticsEnabled ?? true; // TODO: make mapping from our locales to moment locales const language = getLanguageByCode(pageProps.session?.user?.language ?? 'en'); - require(`dayjs/locale/${language.locale}.js`); + if (language.locale !== 'cr') require(`dayjs/locale/${language.locale}.js`); dayjs.locale(language.locale); const [primaryColor, setPrimaryColor] = useState( @@ -101,12 +101,18 @@ function App( return ( <> + {pageProps.locale === 'cr' && ( + <> + + + )} {analyticsEnabled === true && (