Skip to content

Instantly share code, notes, and snippets.

@FreddyPoly
Created July 1, 2019 09:24
Show Gist options
  • Save FreddyPoly/5332ba966478a9c782b806bc84adc474 to your computer and use it in GitHub Desktop.
Save FreddyPoly/5332ba966478a9c782b806bc84adc474 to your computer and use it in GitHub Desktop.
[REACT NATIVE] i18n setup example
import * as RNLocalize from "react-native-localize"
import i18n from "i18n-js"
const en = require("./en")
const ja = require("./ja")
i18n.fallbacks = true
i18n.translations = { en, ja }
const fallback = { languageTag: "en", isRTL: false }
const { languageTag } = RNLocalize.findBestAvailableLanguage(Object.keys(i18n.translations)) || fallback
i18n.locale = languageTag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment