Android 使用react native i18n更改react native应用程序中的语言不工作

Android 使用react native i18n更改react native应用程序中的语言不工作,android,react-native,react-native-android,react-native-ios,mobx,Android,React Native,React Native Android,React Native Ios,Mobx,当用户选择语言时,我试图在运行时更改应用程序的语言。我正试着这样做 import I18n from 'react-native-i18n' onChangeLanguage = () => { console.log('String before change : >>> ', I18n.t('welcome')) I18n.locale = 'hi' console.log('String after change : >>>

当用户选择语言时,我试图在运行时更改应用程序的语言。我正试着这样做

import I18n from 'react-native-i18n'

onChangeLanguage = () => {
    console.log('String before change : >>> ', I18n.t('welcome'))
    I18n.locale = 'hi'
    console.log('String after change : >>> ', I18n.t('welcome'))
}

在两个日志中,我得到了相同的字符串。我引用了他的参考资料。在本文中,有一个redux示例,但我的用例是mobx。如果语言发生更改,如何重新呈现组件以反映语言更改。

您是否事先设置了翻译?例如,
I18n.translations={en:{welcome:'welcome!'},您好:{welcome:'स्वागत हे' } }