2017-09-25 81 views
0

忘记我可怜的英语。 我希望我的应用程序支持两种以上的语言(如英文中文),并且我尝试使用反应原生代替android和iOS.but但我不知道如何知道手机中的语言是,我读了整个文档,但没有得到任何有用的味精。如何在手机中获得当前语言设置

我希望你能理解我通过我可怜你English.Thank非常

+0

这是一个编码社区,你能提供的编码问题,你是面对? –

+1

可能的重复[在反应本机(iOS)中获取设备区域设置的最佳方式是什么?](https://stackoverflow.com/questions/33468746/whats-the-best-way-to-get-device-locale- in-react-native-ios) –

回答

-1

尝试使用这个库的问题 - >https://github.com/AlexanderZaytsev/react-native-i18n

import I18n from 'react-native-i18n'; 
deviceLocale = I18n.currentLocale() 
+0

非常感谢,我使用了库(react-native-device-info)并解决了它。这个库有关于设备的许多信息。 [react-native-device-info](https://github.com/facebook/react-native) 'const DeviceInfo = require('react-native-device-info'); const currentLocale = DeviceInfo.getDeviceLocale();' –

相关问题