UNPKG

@publidata/utils-mapper

Version:

Collection of methods to extract data from publidata

54 lines (46 loc) 1.17 kB
import i18n from "i18next"; import commonTranslationsFR from "./translations/fr/common.json"; import wasteCollectionTranslationsFR from "./translations/fr/wasteCollection.json"; import maskTranslationsFR from "./translations/fr/mask.json"; import canteenMenuTranslationsFR from "./translations/fr/canteenMenu.json"; const resources = { fr: { // Namespaces common: commonTranslationsFR, wasteCollection: wasteCollectionTranslationsFR, mask: maskTranslationsFR, canteenMenu: canteenMenuTranslationsFR } }; i18n.init({ resources, lng: "fr", defaultNS: "common", keySeparator: false, interpolation: { escapeValue: false } }); i18n.addAllResources = ({ translationDictionary }) => { if (translationDictionary) { if (translationDictionary.fr) { i18n.addResourceBundle( "fr", "translation", translationDictionary.fr.translation, true, true ); } if (translationDictionary.en) { i18n.addResourceBundle( "en", "translation", translationDictionary.en.translation, true, true ); } } }; export default i18n;