import en from '../public/locales/en.json' ; import { IFfetchTranslationsOptions , TshouldFetchTrasnslation } from '../_types/shouldFetchTranslations' ; export const fallbackLocale = 'en' ; export const fallbackPreloadedLibrary = en ; fallbackPreloadedLibrary ; const fetchTranslations = { fr : '/locales/fr.json' , es : '/locales/es.json' , de : '/locales/de.json' } ; const shouldFetchtranslation = ( locale ) => { if ( locale . includes ( fallbackLocale ) ) { return 'fallback' ; } const keys = Object . keys ( fetchTranslations ) ; const found = keys . find ( key => locale . includes ( key ) ) ; if ( found ) { return fetchTranslations [ found ] ; } return 'fallback' ; } ; export default shouldFetchtranslation ;