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