From def16f9e97a48e6e53dbc298d2e29ac5896f40f8 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 6 Aug 2020 10:44:41 -0400 Subject: [PATCH] feat: introduce overridable l10nBaseUrl config value --- public/src/modules/translator.js | 2 +- src/controllers/api.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/src/modules/translator.js b/public/src/modules/translator.js index 08d24a1a48..d6c32781ad 100644 --- a/public/src/modules/translator.js +++ b/public/src/modules/translator.js @@ -2,7 +2,7 @@ (function (factory) { function loadClient(language, namespace) { - return Promise.resolve(jQuery.getJSON(config.relative_path + '/assets/language/' + language + '/' + namespace + '.json?' + config['cache-buster'])); + return Promise.resolve(jQuery.getJSON(config.l10nBaseUrl + '/' + language + '/' + namespace + '.json?' + config['cache-buster'])); } var warn = function () { console.warn.apply(console, arguments); }; if (typeof define === 'function' && define.amd) { diff --git a/src/controllers/api.js b/src/controllers/api.js index 6989841c2d..4f1ac43b64 100644 --- a/src/controllers/api.js +++ b/src/controllers/api.js @@ -19,7 +19,8 @@ apiController.loadConfig = async function (req) { let config = { relative_path: nconf.get('relative_path'), upload_url: nconf.get('upload_url'), - requireBaseUrl: nconf.get('relative_path') + '/assets/src/modules', + requireBaseUrl: `${nconf.get('relative_path')}/assets/src/modules`, + l10nBaseUrl: `${nconf.get('relative_path')}/assets/language`, siteTitle: validator.escape(String(meta.config.title || meta.config.browserTitle || 'NodeBB')), browserTitle: validator.escape(String(meta.config.browserTitle || meta.config.title || 'NodeBB')), titleLayout: (meta.config.titleLayout || '{pageTitle} | {browserTitle}').replace(/{/g, '{').replace(/}/g, '}'),