Adding requires for Intl.js locale-data

This commit is contained in:
Tim Mickel 2016-01-21 16:12:04 -05:00
parent d984dba0a6
commit c194ca8c2b
3 changed files with 11 additions and 4 deletions

View file

@ -24,7 +24,8 @@
"WebKitCSSMatrix": true,
"Settings": true,
"MediaLib": true,
"webkitAudioContext": true
"webkitAudioContext": true,
"require": true
},
"extends": "eslint:recommended"
}

View file

@ -20,6 +20,7 @@
"esformatter-quotes": "^1.0.3",
"esformatter-semicolons": "^1.1.2",
"eslint": "^1.10.3",
"expose-loader": "^0.7.1",
"strip-sourcemap-loader": "0.0.1",
"webpack": "^1.12.11"
},

View file

@ -1,9 +1,14 @@
import Cookie from './Cookie';
import Intl from 'intl';
import IntlMessageFormat from 'intl-messageformat';
window.Intl = Intl;
require('intl/locale-data/jsonp/en.js');
require('intl/locale-data/jsonp/es.js');
require('expose?IntlMessageFormat!intl-messageformat');
require('intl-messageformat/dist/locale-data/en');
require('intl-messageformat/dist/locale-data/es');
let currentLocale;
let root = '';
let localizationMessages = {};
@ -68,7 +73,7 @@ export default class Localization {
static localize (key, formatting) {
var message;
if (key in localizationMessages) {
message = new IntlMessageFormat(localizationMessages[key], currentLocale);
message = new window.IntlMessageFormat(localizationMessages[key], currentLocale);
return message.format(formatting);
}
return 'String missing: ' + key;