scratch-www/src/lib/intl.jsx

22 lines
568 B
React
Raw Normal View History

2018-01-30 09:54:45 -05:00
var requireAll = require('./require-all');
var ReactIntl = require('react-intl');
2018-01-30 09:54:45 -05:00
var allLocaleData = requireAll(require.context('react-intl/locale-data', true, /^\.\/.*\.js$/));
var customLocaleData = require('../../custom-locales.json');
/**
* Add all locales
*/
2018-01-30 09:54:45 -05:00
for (var 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.
*/
2018-01-30 09:54:45 -05:00
for (var customLocale in customLocaleData) {
ReactIntl.addLocaleData(customLocaleData[customLocale]);
}
module.exports = ReactIntl;