英文:
How to translate a placeholder field in react.js
问题
我已经完成了标签部分,它正常工作。我已经导入了头文件如下:
import { useTranslation } from 'react-i18next';
const { t, ready } = useTranslation(['accountDetails']);
如何翻译这个占位符:
<TextInput mb={'sm'} label={t('first-name')} placeholder='名字' {...form.getInputProps('firstName')} />
英文:
I have done for label ,its workimg fine.I have imported header file as
import { useTranslation } from 'react-i18next';
and const { t, ready } = useTranslation(['accountDetails']);
How to can I translate this Placeholder:
<TextInput mb={'sm'} label={t('first-name')}
placeholder='First Name'{...form.getInputProps('firstName')} />
答案1
得分: 1
你可以像在标签中这样使用它:
<TextInput mb={'sm'} label={t('first-name')}
placeholder={t('first-name')} {...form.getInputProps('firstName')} />
英文:
You can use it like in label;
<TextInput mb={'sm'} label={t('first-name')}
placeholder={t('first-name')} {...form.getInputProps('firstName')} />
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论