Documentation Index
Fetch the complete documentation index at: https://docs.li.fi/llms.txt
Use this file to discover all available pages before exploring further.
LI.FI 组件 支持国际化(i18n),在我们的社区帮助下,已翻译成多种语言,为您的用户提供本地化的用户体验,使他们更容易理解和与组件交互。
查看支持的语言并通过加入我们在 Crowdin 上的翻译项目来帮助我们翻译:
配置语言
默认情况下,组件为英文。您可以配置默认语言、要在组件内显示的语言,或者如果您隐藏内置语言选择,用户可以看到组件的语言。
语言配置有 allow、deny 和 default 选项。
import { LiFiWidget, WidgetConfig } from '@lifi/widget';
const widgetConfig: WidgetConfig = {
// hide the language selection part of the UI
// hiddenUI: ['language'],
languages: {
// default to German
default: 'de',
// allow German and Spanish languages only
allow: ['de', 'es'],
// disable Chinese from being shown in the languages list
// deny: ['zh'],
},
};
export const WidgetPage = () => {
return (
<LiFiWidget integrator="Your dApp/company name" config={widgetConfig} />
);
};
Language Resources
You can customize the widget to support any language that your dApp needs by providing language resources.
Rather than trying to add a language via config, it’s best to first consider helping us to translate the language you need by joining our Crowdin translation project. 🙂
import { LiFiWidget, WidgetConfig } from '@lifi/widget';
import es from './i18n/es.json';
const widgetConfig: WidgetConfig = {
languageResources: {
es,
},
};
export const WidgetPage = () => {
return (
<LiFiWidget integrator="Your dApp/company name" config={widgetConfig} />
);
};
Also, you can customize the existing language resources if you want to adjust some text. Find the complete list of key-value pairs 中 reference en.json in our repository here.
import { LiFiWidget, WidgetConfig } from '@lifi/widget';
const widgetConfig: WidgetConfig = {
languageResources: {
en: {
button: { swap: 'Test swap' },
},
},
};
export const WidgetPage = () => {
return (
<LiFiWidget integrator="Your dApp/company name" config={widgetConfig} />
);
};