Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// TODO
// don't load all translations in memory, when we have a lot of translations
// see
// https://github.com/react-native-community/react-native-localize/blob/master/example/src/AsyncExample.js
import * as RNLocalize from 'react-native-localize'
import I18n from 'i18n-js'
const de = require('./de.json')
const nl = require('./nl.json')
I18n.defaultLocale = 'en'
I18n.fallbacks = true
I18n.missingTranslation = scope => scope
I18n.translations = {
de,
nl,
}
export const locales = ['en', 'de', 'nl']
const fallback = { languageTag: 'en', isRTL: false }
const { languageTag } =
RNLocalize.findBestAvailableLanguage(locales) || fallback
I18n.locale = languageTag
const localeSpecificImages = {
en: {
'01.jpg': require('src/resources/img/en/01.jpg'),
'02.jpg': require('src/resources/img/en/02.jpg'),
'03.jpg': require('src/resources/img/en/03.jpg'),