From e82284eaf377bea545d2044755bf8589ac29669e Mon Sep 17 00:00:00 2001 From: okjodom Date: Thu, 20 Jul 2023 10:05:57 -0700 Subject: [PATCH 1/3] fix: set fallback lang to en-US --- packages/utils/src/i18n.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/utils/src/i18n.tsx b/packages/utils/src/i18n.tsx index 708836546..08a1e26f1 100644 --- a/packages/utils/src/i18n.tsx +++ b/packages/utils/src/i18n.tsx @@ -14,8 +14,8 @@ export const i18nProvider = (namespace: Array) => { i18n.use(LanguageDetector).use(initReactI18next).init({ debug: true, resources, - fallbackLng: 'en', - }); + fallbackLng: 'en-US', + }) }; export { useTranslation }; From e336b87ea2d12fa61c993e5785fe6eb319b3d245 Mon Sep 17 00:00:00 2001 From: okjodom Date: Thu, 20 Jul 2023 10:07:55 -0700 Subject: [PATCH 2/3] feat: add typings to translation utils --- packages/utils/src/i18n.tsx | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/utils/src/i18n.tsx b/packages/utils/src/i18n.tsx index 08a1e26f1..e4f63803a 100644 --- a/packages/utils/src/i18n.tsx +++ b/packages/utils/src/i18n.tsx @@ -1,21 +1,24 @@ import i18n from 'i18next'; import LanguageDetector from 'i18next-browser-languagedetector'; import { initReactI18next } from 'react-i18next'; -import { useTranslation } from 'react-i18next'; +export { useTranslation } from 'react-i18next'; -export const i18nProvider = (namespace: Array) => { - const resources = namespace.reduce((acc, lng) => { - return { - ...acc, - [lng['key']]: { translation: lng['translation'] }, - }; - }, {}); +type Language = { key: string; description: string; translation: object }; + +export const i18nProvider = (namespace: Language[]) => { + const resources = namespace.reduce( + (acc, { key, translation, description }) => { + return { + ...acc, + [key]: { translation, description }, + }; + }, + {} + ); i18n.use(LanguageDetector).use(initReactI18next).init({ debug: true, resources, fallbackLng: 'en-US', - }) + }); }; - -export { useTranslation }; From e44e6ea1ceaec012429b4a0dfcc781326b2e0f12 Mon Sep 17 00:00:00 2001 From: okjodom Date: Thu, 20 Jul 2023 10:08:09 -0700 Subject: [PATCH 3/3] chore: lint fix --- apps/gateway-ui/src/components/WithdrawTab.tsx | 2 +- apps/guardian-ui/src/setup/FederationSetup.tsx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/gateway-ui/src/components/WithdrawTab.tsx b/apps/gateway-ui/src/components/WithdrawTab.tsx index 28aa62f60..55c3b5324 100644 --- a/apps/gateway-ui/src/components/WithdrawTab.tsx +++ b/apps/gateway-ui/src/components/WithdrawTab.tsx @@ -92,7 +92,7 @@ export const WithdrawTab = React.memo(function WithdrawTab({ setWithdrawObject({ ...withdrawObject, amount: 0, address: '' }); setModalState(false); }) - .catch(({ message, error }) => { + .catch(({ error }) => { console.error(error); setError(`${t('withdraw_tab.error_request')}`); }); diff --git a/apps/guardian-ui/src/setup/FederationSetup.tsx b/apps/guardian-ui/src/setup/FederationSetup.tsx index aeb72fdd7..6b3305257 100644 --- a/apps/guardian-ui/src/setup/FederationSetup.tsx +++ b/apps/guardian-ui/src/setup/FederationSetup.tsx @@ -19,7 +19,6 @@ import { ConnectGuardians } from '../components/ConnectGuardians'; import { RunDKG } from '../components/RunDKG'; import { VerifyGuardians } from '../components/VerifyGuardians'; import { SetupComplete } from '../components/SetupComplete'; -import { SetupProgress as SetupStepper } from '../components/SetupProgress'; import { useTranslation } from '@fedimint/utils'; const PROGRESS_ORDER: SetupProgress[] = [