Created
January 16, 2017 12:58
-
-
Save EQuimper/8fd2960abb0190f3b4677a5a28babf9c to your computer and use it in GitHub Desktop.
react-native exponent i18n
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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