2016-08-08 11:18:21 +09:00
|
|
|
import Telescope from './config.js';
|
|
|
|
|
2016-06-09 17:42:20 +09:00
|
|
|
var areIntlLocalesSupported = require('intl-locales-supported');
|
|
|
|
|
|
|
|
var localesMyAppSupports = [
|
2016-06-16 10:43:59 +09:00
|
|
|
Telescope.settings.get("locale", "en")
|
2016-06-09 17:42:20 +09:00
|
|
|
];
|
|
|
|
|
|
|
|
if (global.Intl) {
|
|
|
|
// Determine if the built-in `Intl` has the locale data we need.
|
|
|
|
if (!areIntlLocalesSupported(localesMyAppSupports)) {
|
|
|
|
// `Intl` exists, but it doesn't have the data we need, so load the
|
|
|
|
// polyfill and replace the constructors with need with the polyfill's.
|
|
|
|
var IntlPolyfill = require('intl');
|
|
|
|
Intl.NumberFormat = IntlPolyfill.NumberFormat;
|
|
|
|
Intl.DateTimeFormat = IntlPolyfill.DateTimeFormat;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// No `Intl`, so use and load the polyfill.
|
|
|
|
global.Intl = require('intl');
|
|
|
|
}
|