Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 1x 1x | import { NativeModules } from 'react-native'; import { SUPPORTED_LANGUAGES } from './constants.js'; const { I18n } = NativeModules; export const getDefaultLang = () => { if (I18n && I18n.language) { const locale = I18n.language.split('_', 2); const lang = locale[0]; if (SUPPORTED_LANGUAGES.includes(lang)) { return lang; } } return 'en'; }; |