aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-06 16:46:42 +0200
committerChocobozzz <me@florianbigard.com>2018-06-06 16:48:41 +0200
commit7ce44a74a3b052190cfacd4bd5ee6b92cfc620ac (patch)
tree6f178426c165f9136eb08354efa4a06c24725f87 /server
parentf07d6385b4b46c3254898292a8a53ed415b8d49b (diff)
downloadPeerTube-7ce44a74a3b052190cfacd4bd5ee6b92cfc620ac.tar.gz
PeerTube-7ce44a74a3b052190cfacd4bd5ee6b92cfc620ac.tar.zst
PeerTube-7ce44a74a3b052190cfacd4bd5ee6b92cfc620ac.zip
Add server localization
Diffstat (limited to 'server')
-rw-r--r--server/controllers/client.ts7
-rw-r--r--server/initializers/constants.ts3
2 files changed, 7 insertions, 3 deletions
diff --git a/server/controllers/client.ts b/server/controllers/client.ts
index b153f6086..ec78a4bbc 100644
--- a/server/controllers/client.ts
+++ b/server/controllers/client.ts
@@ -48,8 +48,11 @@ clientsRouter.use('/client', express.static(distPath, { maxAge: STATIC_MAX_AGE }
48clientsRouter.use('/client/assets/images', express.static(assetsImagesPath, { maxAge: STATIC_MAX_AGE })) 48clientsRouter.use('/client/assets/images', express.static(assetsImagesPath, { maxAge: STATIC_MAX_AGE }))
49 49
50clientsRouter.use('/client/locales/:locale/:file.json', function (req, res) { 50clientsRouter.use('/client/locales/:locale/:file.json', function (req, res) {
51 if (req.params.locale === 'fr' && req.params.file === 'player') { 51 const locale = req.params.locale
52 return res.sendFile(join(__dirname, '../../../client/dist/locale/player_fr.json')) 52 const file = req.params.file
53
54 if (is18nLocale(locale) && [ 'player', 'server' ].indexOf(file) !== -1) {
55 return res.sendFile(join(__dirname, `../../../client/dist/locale/${file}_${locale}.json`))
53 } 56 }
54 57
55 return res.sendStatus(404) 58 return res.sendStatus(404)
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 26ee3db47..9b459c241 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -500,7 +500,8 @@ export {
500 STATIC_DOWNLOAD_PATHS, 500 STATIC_DOWNLOAD_PATHS,
501 RATES_LIMIT, 501 RATES_LIMIT,
502 JOB_COMPLETED_LIFETIME, 502 JOB_COMPLETED_LIFETIME,
503 VIDEO_VIEW_LIFETIME 503 VIDEO_VIEW_LIFETIME,
504 buildLanguages
504} 505}
505 506
506// --------------------------------------------------------------------------- 507// ---------------------------------------------------------------------------