1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 09:49:20 +02:00

Add email translations

Convert emails from Pug template to Handlebars because i18next doesn't
support Pug
This commit is contained in:
Chocobozzz 2025-07-18 11:04:30 +02:00
parent b45fbf4337
commit d6e4dac032
No known key found for this signature in database
GPG key ID: 583A612D890159BE
223 changed files with 9859 additions and 1426 deletions

View file

@ -0,0 +1,36 @@
import { is18nLocale } from '@peertube/peertube-core-utils'
import { HttpStatusCode } from '@peertube/peertube-models'
import { setClientLanguageCookie } from '@server/helpers/i18n.js'
import express from 'express'
import { apiRateLimiter } from '../../middlewares/index.js'
const clientConfigRouter = express.Router()
clientConfigRouter.use(apiRateLimiter)
clientConfigRouter.post(
'/update-interface-language',
updateLanguage
)
// ---------------------------------------------------------------------------
export {
clientConfigRouter
}
// ---------------------------------------------------------------------------
function updateLanguage (req: express.Request, res: express.Response) {
const language = req.body.language
if (language !== null && !is18nLocale(language)) {
return res.fail({
message: req.t('{language} is not a valid language', { language })
})
}
setClientLanguageCookie(res, language)
return res.sendStatus(HttpStatusCode.NO_CONTENT_204)
}