Skip to content

Instantly share code, notes, and snippets.

@EQuimper
Created January 16, 2017 12:58
Show Gist options
  • Save EQuimper/8fd2960abb0190f3b4677a5a28babf9c to your computer and use it in GitHub Desktop.
Save EQuimper/8fd2960abb0190f3b4677a5a28babf9c to your computer and use it in GitHub Desktop.
react-native exponent i18n
import i18n from 'react-native-i18n'
import Exponent from 'exponent'
import es from '../locales/es'
import en from '../locales/en'
i18n.fallbacks = true
const getLanguage = async () => {
i18n.locale = (await Exponent.Util.getCurrentLocaleAsync()).substring(0,2)
}
getLanguage()
i18n.translations = {
'es': es,
'en': en,
}
export default i18n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment