Commit d16dd06 1 parent 54c68d6 commit d16dd06 Copy full SHA for d16dd06
File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 6
6
7
7
'use strict'
8
8
9
+ // Node.js i18n support
10
+ require ( './intl' )
11
+
9
12
// template render function
10
13
const render = require ( './lib/render' )
11
14
Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ let areIntlLocalesSupported = require ( 'intl-locales-supported' )
4
+ if ( typeof areIntlLocalesSupported !== 'function' && areIntlLocalesSupported . default ) {
5
+ areIntlLocalesSupported = areIntlLocalesSupported . default
6
+ }
7
+
8
+ const localesMyAppSupports = [
9
+ 'en' ,
10
+ 'pt-BR'
11
+ ]
12
+
13
+ if ( global . Intl ) {
14
+ // Determine if the built-in `Intl` has the locale data we need.
15
+ if ( ! areIntlLocalesSupported ( localesMyAppSupports ) ) {
16
+ // `Intl` exists, but it doesn't have the data we need, so load the
17
+ // polyfill and patch the constructors we need with the polyfill's.
18
+ const IntlPolyfill = require ( 'intl' )
19
+ Intl . NumberFormat = IntlPolyfill . NumberFormat
20
+ Intl . DateTimeFormat = IntlPolyfill . DateTimeFormat
21
+ }
22
+ } else {
23
+ // No `Intl`, so use and load the polyfill.
24
+ global . Intl = require ( 'intl' )
25
+ }
You can’t perform that action at this time.
0 commit comments