Search Docs
国际化开发指南
zh-CN
import { Plugin } from '@tachybase/client'; class PluginDemoClient extends Plugin { async load() { // i18n 实例 this.app.i18n; this.app.i18n.t('hello'); await this.app.i18n.changeLanguage('zh-CN'); } }
详细说明请参考 I18next API 文档
import { useApp } from '@tachybase/client'; import { useTranslation } from 'react-i18next'; const { i18n } = useApp(); const { t } = useTranslation(); t('hello');
useTranslation() 的详细使用说明参考 react-i18next 文档
const schema = { type: 'string', title: '{{t("I'm fine", { ns: "core" })}}', 'x-component': 'FormItem', 'x-component': 'Input', };
或者
import { tval } from '@tachybase/client'; const schema = { type: 'string', title: tval("I'm fine", { ns: 'core', ...others }), 'x-component': 'FormItem', 'x-component': 'Input', };