diff options
i18n - derrive locale codes from index
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/lib/get-first-preferred-lang-code.js | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/app/scripts/lib/get-first-preferred-lang-code.js b/app/scripts/lib/get-first-preferred-lang-code.js index 849018f26..28612f763 100644 --- a/app/scripts/lib/get-first-preferred-lang-code.js +++ b/app/scripts/lib/get-first-preferred-lang-code.js @@ -1,9 +1,8 @@ -const fs = require('fs') -const path = require('path') const extension = require('extensionizer') const promisify = require('pify') +const allLocales = require('../../_locales/index.json') -const existingLocaleCodes = fs.readdirSync(path.join(__dirname, '..', '..', '_locales')) +const existingLocaleCodes = allLocales.map(locale => locale.code) async function getFirstPreferredLangCode () { const userPreferredLocaleCodes = await promisify( |