2017-09-25 82 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();' –

相關問題