【发布时间】:2018-07-18 22:27:17
【问题描述】:
我正在尝试使用库https://github.com/AlexanderZaytsev/react-native-i18n
有效,但警告
react-native-i18n module is not correctly linked
仍然出现。
我用npm install react-native-i18n --save安装了它
版本
react-native-cli: 2.0.1
react-native: 0.55.4
npm: 5.6.0
代码
以上App.js:
import I18n from 'react-native-i18n';
I18n.locale = I18n.currentLocale();
I18n.fallbacks = true;
I18n.translations = {en: {GENERAL: {NAME: 'example'}}};
在渲染中:
render(){
return (
<View>
<Text>{I18n.t('GENERAL.NAME')}</Text>
</View>
);
}
我已经看过这些,但我找不到答案:
- react-native-i18n module linking with expo
- https://github.com/AlexanderZaytsev/react-native-i18n/issues/177
我使用安卓手机(小米红米note 5,Expo app)进行了测试。
感谢您的帮助。
【问题讨论】:
-
你试过
react-native-link react-native-i18n吗?
标签: reactjs react-native