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