Sha256: 829983e1c1c572f18498b9ea199a17094c80154f08acd41251e7ad505d7e88e9
Contents?: true
Size: 766 Bytes
Versions: 11
Compression:
Stored size: 766 Bytes
Contents
/* eslint-disable no-param-reassign */ import { I18n } from 'react-i18nify'; import requireAll from './require_all'; /** * Load components translations from yaml files and import them into * react-i18ify system so they can be used via `I18n.t` method. * @returns {Void} - Nothing */ const loadTranslations = () => { const translationsContext = require.context('../../../config/locales/', true, /\.yml$/); const translationFiles = requireAll(translationsContext); const translations = translationsContext.keys().reduce((acc, key, index) => { const locale = key.match(/\.\/(.*)\.yml/)[1]; acc[locale] = translationFiles[index][locale].decidim; return acc; }, {}); I18n.setTranslations(translations); }; export default loadTranslations;
Version data entries
11 entries across 11 versions & 2 rubygems