2017-10-17 8 views
0

iosデバイスから現在のロケールを取得しようとしています。Native get iosデバイス言語

私はプロジェクトを作成したときにthis guideに続き、私は博覧会を使っています。

私は、次のコード

if (Platform.OS === "android") { 
    langRegionLocale = NativeModules.I18nManager.localeIdentifier || ""; 
} else if (Platform.OS === "ios") { 
    langRegionLocale = NativeModules.SettingsManager.settings.AppleLocale || ""; 
} 

を試してみましたが、それはアンドロイドのために働いたが、iPhone上で試験したとき、それは動作しませんでしたし、私はそれをログインしたときにはSettingsManagerがを未定義と述べました。

ios の現在のロケールを取り出したり使用したりすることなく、どのようにして取得できますかAlexanderZaytsev/react-native-i18n?以下は

可能であれば、私はに組み込まれているものを使用したいと思います。

package.json

{ 
    "name": "demoapp", 
    "version": "0.1.0", 
    "private": true, 
    "devDependencies": { 
    "react-native-scripts": "1.5.0", 
    "jest-expo": "^21.0.2", 
    "react-test-renderer": "16.0.0-alpha.12" 
    }, 
    "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js", 
    "scripts": { 
    "start": "react-native-scripts start", 
    "eject": "react-native-scripts eject", 
    "android": "react-native-scripts android", 
    "ios": "react-native-scripts ios", 
    "test": "node node_modules/jest/bin/jest.js --watch" 
    }, 
    "jest": { 
    "preset": "jest-expo" 
    }, 
    "dependencies": { 
    "expo": "^21.0.0", 
    "react": "16.0.0-alpha.12", 
    "react-native": "^0.48.4", 
    "react-navigation": "^1.0.0-beta.13", 
    "react-redux": "^5.0.6", 
    "redux": "^3.7.2", 
    "redux-thunk": "^2.2.0" 
    } 
} 

答えて

関連する問題