Skip to content

Commit

Permalink
feat: rename disableI18n -> disableLanguageDetector
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov committed Apr 19, 2023
1 parent 95af501 commit 186d28c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
1 change: 0 additions & 1 deletion packages/widget-embedded/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const widgetBaseConfig: WidgetConfig = {
// fromAmount: '20',
// toAddress: '0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0',

disableTelemetry: false,
variant: 'nft',
integrator: 'li.fi-playground',
// hiddenUI: ['poweredBy', 'language', 'appearance'],
Expand Down
3 changes: 1 addition & 2 deletions packages/widget-playground/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { supportedWallets } from '@lifi/wallet-management';
import type { WidgetConfig } from '@lifi/widget';
import './index.css';
import { supportedWallets } from '@lifi/wallet-management';

export const METAMASK_WALLET = supportedWallets.find(
(wallet) => wallet.name === 'MetaMask',
Expand All @@ -21,7 +21,6 @@ export const widgetBaseConfig: WidgetConfig = {
// fromAmount: '20',
// toAddress: '0x552008c0f6870c2f77e5cC1d2eb9bdff03e30Ea0',

disableTelemetry: false,
variant: 'expandable',
integrator: 'li.fi-playground',
// hiddenUI: ['poweredBy', 'language', 'appearance'],
Expand Down
17 changes: 13 additions & 4 deletions packages/widget-playground/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@
"rootDir": "./src",
"composite": true
},
"include": ["src"],
"include": [
"src",
"./src/**/*.json"
],
"references": [
{ "path": "./tsconfig.node.json" },
{ "path": "../wallet-management" },
{ "path": "../widget" }
{
"path": "./tsconfig.node.json"
},
{
"path": "../wallet-management"
},
{
"path": "../widget"
}
]
}
7 changes: 4 additions & 3 deletions packages/widget/src/providers/I18nProvider/I18nProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import type { LanguageKey, LanguageTranslationResources } from './types';
export const I18nProvider: React.FC<React.PropsWithChildren> = ({
children,
}) => {
const { languageResources, languages, disableI18n } = useWidgetConfig();
const { languageResources, languages, disableLanguageDetector } =
useWidgetConfig();
const { language } = useSettings(['language']);

const i18n = useMemo(() => {
Expand Down Expand Up @@ -57,14 +58,14 @@ export const I18nProvider: React.FC<React.PropsWithChildren> = ({
},
});

if (!language && !languages?.default && !disableI18n) {
if (!language && !languages?.default && !disableLanguageDetector) {
i18n = i18n.use(LanguageDetector);
}

i18n.use(initReactI18next).init();

return i18n;
}, [disableI18n, language, languageResources, languages]);
}, [disableLanguageDetector, language, languageResources, languages]);

return <I18nextProvider i18n={i18n}>{children}</I18nextProvider>;
};
3 changes: 1 addition & 2 deletions packages/widget/src/types/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ export interface WidgetConfig {
theme?: ThemeConfig;
containerStyle?: CSSProperties;

disableTelemetry?: boolean;
disabledUI?: DisabledUIType[];
hiddenUI?: HiddenUIType[];
requiredUI?: RequiredUIType[];
Expand Down Expand Up @@ -158,7 +157,7 @@ export interface WidgetConfig {
deny?: LanguageKey[];
};
languageResources?: LanguageResources;
disableI18n?: boolean;
disableLanguageDetector?: boolean;
}

export type WidgetDrawerProps = {
Expand Down

0 comments on commit 186d28c

Please sign in to comment.