move to nuxt-i18n, switch language,address #171
This commit is contained in:
@@ -63,13 +63,6 @@ module.exports = {
|
||||
})
|
||||
},
|
||||
|
||||
async setUserLocale(req, res, next) {
|
||||
// select locale based on cookie? and accept-language header
|
||||
acceptLanguage.languages(Object.keys(locales))
|
||||
res.locals.acceptedLocale = acceptLanguage.get(req.headers['accept-language'])
|
||||
dayjs.locale(res.locals.acceptedLocale)
|
||||
next()
|
||||
},
|
||||
|
||||
async initSettings(_req, res, next) {
|
||||
// initialize settings
|
||||
|
||||
@@ -5,7 +5,6 @@ const initialize = require('./initialize.server')
|
||||
|
||||
const config = require('./config')
|
||||
const helpers = require('./helpers')
|
||||
app.use(helpers.setUserLocale)
|
||||
app.use(helpers.initSettings)
|
||||
app.use(helpers.logRequest)
|
||||
app.use(helpers.serveStatic())
|
||||
@@ -73,10 +72,9 @@ async function main () {
|
||||
|
||||
// remaining request goes to nuxt
|
||||
// first nuxt component is ./pages/index.vue (with ./layouts/default.vue)
|
||||
// prefill current events, tags, places and announcements (used in every path)
|
||||
app.use(async (_req, res, next) => {
|
||||
if (config.status === 'READY') {
|
||||
|
||||
// TODO: fetch into layout!
|
||||
const announceController = require('./api/controller/announce')
|
||||
res.locals.announcements = await announceController._getVisible()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user