feat(errors): dynamic fallback locale
This commit is contained in:
committed by
Benedikt Rötsch
parent
92fcbdf4d8
commit
3c9089af98
6
app.js
6
app.js
@@ -11,7 +11,7 @@ const helmet = require('helmet')
|
||||
require('dotenv').config({ path: 'variables.env' })
|
||||
|
||||
const helpers = require('./helpers')
|
||||
const { translate, initializeTranslations } = require('./i18n/i18n')
|
||||
const { translate, initializeTranslations, setFallbackLocale } = require('./i18n/i18n')
|
||||
const breadcrumb = require('./lib/breadcrumb')
|
||||
const { updateCookie } = require('./lib/cookies')
|
||||
const settings = require('./lib/settings')
|
||||
@@ -110,6 +110,10 @@ app.use(catchErrors(async function (request, response, next) {
|
||||
response.locals.currentLocale = defaultLocale
|
||||
}
|
||||
|
||||
if (response.locals.fallbackCode) {
|
||||
setFallbackLocale(response.locals.fallbackCode)
|
||||
}
|
||||
|
||||
// Creates a query string which adds the current credentials to links
|
||||
// To other implementations of this app in the about modal
|
||||
helpers.updateSettingsQuery(request, response, response.locals.settings)
|
||||
|
||||
Reference in New Issue
Block a user