Skip to content

Commit

Permalink
Merge pull request #99 from okjodom/fallback-lng
Browse files Browse the repository at this point in the history
Fix fallback language
  • Loading branch information
justinmoon committed Jul 20, 2023
2 parents 057c8f9 + e44e6ea commit 25f2dd8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion apps/gateway-ui/src/components/WithdrawTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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')}`);
});
Expand Down
1 change: 0 additions & 1 deletion apps/guardian-ui/src/setup/FederationSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [
Expand Down
25 changes: 14 additions & 11 deletions packages/utils/src/i18n.tsx
Original file line number Diff line number Diff line change
@@ -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<any>) => {
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',
fallbackLng: 'en-US',
});
};

export { useTranslation };

0 comments on commit 25f2dd8

Please sign in to comment.