Created
August 4, 2017 20:13
-
-
Save rgalite/ff3d8726b77e7a18358fa376c33b18c1 to your computer and use it in GitHub Desktop.
Revisions
-
Rudth-Mael Galite created this gist
Aug 4, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ import areIntlLocalesSupported from 'intl-locales-supported' const localesMyAppSupports = [ 'fr', 'en', ] 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 patch the constructors we 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'); }