Ingen beskrivning

index.js 499B

1234567891011121314151617181920212223242526
  1. import I18n from "ex-react-native-i18n";
  2. import { Localization } from 'expo-localization'
  3. import { I18nManager } from "react-native";
  4. import en from './en.json'
  5. import es from './es.json'
  6. I18n.translations = {
  7. en,
  8. es
  9. }
  10. const getLanguage = async() => {
  11. try { const choice = await Localization.locale
  12. I18n.locale = choice.substr(0, 2)
  13. I18n.initAsync()
  14. }catch(error){
  15. console.log('Unable to get locale')
  16. }
  17. }
  18. getLanguage()
  19. export function t(name){
  20. return I18n.t(name)
  21. }