1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +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

@ -1,13 +1,14 @@
import {
AVAILABLE_LOCALES,
buildFileLocale,
escapeHTML,
getDefaultLocale,
getDefaultRSSFeeds,
is18nLocale,
POSSIBLE_LOCALES
is18nLocale
} from '@peertube/peertube-core-utils'
import { HTMLServerConfig } from '@peertube/peertube-models'
import { isTestOrDevInstance, root, sha256 } from '@peertube/peertube-node-utils'
import { setClientLanguageCookie } from '@server/helpers/i18n.js'
import { CONFIG } from '@server/initializers/config.js'
import { getServerActor } from '@server/models/application/application.js'
import express from 'express'
@ -125,15 +126,11 @@ export class PageHtml {
lang = paramLang
// Save locale in cookies
res.cookie('clientLanguage', lang, {
secure: true,
sameSite: 'none',
maxAge: 1000 * 3600 * 24 * 90 // 3 months
})
setClientLanguageCookie(res, lang)
} else if (req.cookies.clientLanguage && is18nLocale(req.cookies.clientLanguage)) {
lang = req.cookies.clientLanguage
} else {
lang = req.acceptsLanguages(POSSIBLE_LOCALES) || getDefaultLocale()
lang = req.acceptsLanguages(AVAILABLE_LOCALES) || getDefaultLocale()
}
logger.debug(