scratch-www/src/lib/intl.jsx

22 lines
580 B
React
Raw Normal View History

const requireAll = require('./require-all');
const ReactIntl = require('react-intl');
const allLocaleData = requireAll(require.context('react-intl/locale-data', true, /^\.\/.*\.js$/));
const customLocaleData = require('../../custom-locales.json');
/**
* Add all locales
*/
for (const locale in allLocaleData) {
ReactIntl.addLocaleData(allLocaleData[locale]);
}
2016-01-14 10:25:03 -05:00
/**
* Add custom locales to react-intl if it doesn't have them.
*/
for (const customLocale in customLocaleData) {
ReactIntl.addLocaleData(customLocaleData[customLocale]);
}
module.exports = ReactIntl;