i18n: Fix urls while not / exists
This commit is contained in:
parent
d590582a85
commit
0498ea8541
2
app.js
2
app.js
@ -86,6 +86,8 @@ const csrfProtection = csrf({ cookie: true });
|
||||
app.use(csrfProtection);
|
||||
app.use(/\/(fr|en)/i, indexRouter);
|
||||
app.use(/\/(fr|en)\/auth/i, authRouter);
|
||||
app.use("/", indexRouter);
|
||||
app.use("/auth", authRouter);
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
app.use(function (req, res, next) {
|
||||
|
@ -7,7 +7,10 @@ function indexPage(req, res) {
|
||||
}
|
||||
|
||||
function loginPage(req, res) {
|
||||
res.render('auth/login');
|
||||
res.render('auth/login', {
|
||||
title: req.i18n.__("SoundBirder - Login"),
|
||||
locale: req.i18n.locale
|
||||
});
|
||||
}
|
||||
|
||||
function login(req, res) {
|
||||
@ -19,11 +22,14 @@ function logout(req, res) {
|
||||
}
|
||||
|
||||
function registerPage(req, res) {
|
||||
res.render('auth/register');
|
||||
res.render('auth/register', {
|
||||
title: req.i18n.__("SoundBirder - Register"),
|
||||
locale: req.i18n.locale
|
||||
});
|
||||
}
|
||||
|
||||
function register(req, res) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
function forgotPassword(req, res) {
|
||||
|
@ -2,12 +2,16 @@
|
||||
function getIndex(req, res) {
|
||||
res.render('index', {
|
||||
title: 'SoundBirder',
|
||||
csrf_token: req.csrfToken()
|
||||
csrf_token: req.csrfToken(),
|
||||
locale: req.i18n.locale
|
||||
});
|
||||
}
|
||||
|
||||
function getAbout(req, res) {
|
||||
res.render('about', { title: 'About SoundBirder' });
|
||||
res.render('about', {
|
||||
title: 'About SoundBirder',
|
||||
locale: req.i18n.locale
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
@ -10,11 +10,12 @@ html
|
||||
header
|
||||
h1= title
|
||||
nav
|
||||
- var i18n_prefix = locale ? '/' + locale : ''
|
||||
ul
|
||||
li
|
||||
a(href="/") #{ __("Game") }
|
||||
a(href=`${i18n_prefix}/`) #{ __("Game") }
|
||||
li
|
||||
a(href="/about") #{ __("About") }
|
||||
a(href=`${i18n_prefix}/about`) #{ __("About") }
|
||||
main
|
||||
block content
|
||||
footer
|
||||
|
Loading…
x
Reference in New Issue
Block a user