Fix language choice for server-side generation

parent 7e635425
Pipeline #1509 passed with stage
in 39 seconds
......@@ -14,7 +14,7 @@ app.set('view engine', 'pug');
app.use(express.static('./static'));
app.use(function(req, res, next) {
let locale = req.query.lang || req.headers['accept-language'] || '';
let locale = req.query.changeLang || req.query.lang || req.headers['accept-language'] || '';
req.i18n = new i18n();
if (locale.indexOf('en') !== -1
&& locale.indexOf('fr') !== -1)
......
......@@ -22,6 +22,7 @@ html(lang=locale)
=_('Soutenez La Quadrature du Net !')
body
form(action="./generate.png" target="_blank")
input(type="hidden" name="lang" value=locale)
nav
a
img(src="./imgs/logo_lqdn.svg" alt="LQDN")
......@@ -106,9 +107,9 @@ html(lang=locale)
=_('GÉNÉRER')
main
div#langPicker
button(type="submit" name="lang" value="fr" formaction="" formtarget="_self")#frButton
button(type="submit" name="changeLang" value="fr" formaction="" formtarget="_self")#frButton
=_('Français')
button(type="submit" name="lang" value="en" formaction="" formtarget="_self")#enButton
button(type="submit" name="changeLang" value="en" formaction="" formtarget="_self")#enButton
=_('Anglais')
div
noscript
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment