diff --git a/server/config.js b/server/config.js index 6a5deffa..60d3705c 100644 --- a/server/config.js +++ b/server/config.js @@ -273,6 +273,11 @@ const conf = convict({ default: '#003eaa', env: 'UI_COLOR_ACCENT' }, + custom_locale: { + format: String, + default: '', + env: 'CUSTOM_LOCALE' + }, ui_custom_assets: { android_chrome_192px: { format: String, diff --git a/server/state.js b/server/state.js index 469f0282..83d663a0 100644 --- a/server/state.js +++ b/server/state.js @@ -3,9 +3,18 @@ const layout = require('./layout'); const assets = require('../common/assets'); const getTranslator = require('./locale'); const { getFxaConfig } = require('./fxa'); +const fs = require('fs'); +const path = require('path'); module.exports = async function(req) { - const locale = req.language || 'en-US'; + const locale = (() => { + if (config.custom_locale != '' && fs.existsSync(path.join(__dirname,'../public/locales',config.custom_locale))) { + return config.custom_locale; + } + else { + return req.language || 'en-US'; + } + })(); let authConfig = null; let robots = 'none'; if (req.route && req.route.path === '/') {