我希望我的应用程序支持多种语言,例如英语和中文。使用 native react ,我如何找到手机上的语言设置?
最佳答案
import { NativeModules, Platform } from 'react-native';
const deviceLanguage =
Platform.OS === 'ios'
? NativeModules.SettingsManager.settings.AppleLocale ||
NativeModules.SettingsManager.settings.AppleLanguages[0] // iOS 13
: NativeModules.I18nManager.localeIdentifier;
console.log(deviceLanguage); //en_US
关于javascript - 如何使用 native react 在手机中获取当前语言设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46399057/