diff --git a/frontend/scripts/build-locales.js b/frontend/scripts/build-locales.js index 8ca37b7b..599b7e0d 100644 --- a/frontend/scripts/build-locales.js +++ b/frontend/scripts/build-locales.js @@ -5,7 +5,6 @@ const Ncp = require('ncp'); const readdir = thenify(fs.readdir); const writeFile = thenify(fs.writeFile); -const readFile = thenify(fs.readFile); const ncp = thenify(Ncp.ncp); const root = path.join(__dirname, '../locales'); @@ -27,7 +26,7 @@ const compile = async () => { const files = await readdir(root); const jsons = files.filter(filename => path.extname(filename) === '.json'); - const locales = files.reduce((res, filename) => { + const locales = jsons.reduce((res, filename) => { const name = path.parse(filename).name; const json = JSON.stringify(require(path.join(root, filename))); const lang = name.split(/\-/)[0]; @@ -52,8 +51,6 @@ const compile = async () => { return ncp(source, destination); })); - - return await Promise.all(Object.keys(locales).map((name) => { console.log(`Writing ${name}.js`); diff --git a/frontend/src/intl.js b/frontend/src/intl.js index c771ce54..2a531164 100644 --- a/frontend/src/intl.js +++ b/frontend/src/intl.js @@ -25,8 +25,9 @@ module.exports = (({ ).toLowerCase(); const lang = detectedLocale.split(/\-/)[0]; - const locale = ReactIntlLocaleData[lang] ? - (Locales[detectedLocale] ? detectedLocale : 'en-us') : 'en-us'; + const locale = ReactIntlLocaleData[lang] + ? (Locales[detectedLocale] ? detectedLocale : 'en-us') + : 'en-us'; return { locale, diff --git a/frontend/src/root.js b/frontend/src/root.js index db12152c..b92b2515 100644 --- a/frontend/src/root.js +++ b/frontend/src/root.js @@ -1,4 +1,3 @@ -const qs = require('querystring'); const React = require('react'); const ReactIntlRedux = require('react-intl-redux'); const ReactHotLoader = require('react-hot-loader');