diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-06 16:46:42 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-06 16:48:41 +0200 |
commit | 7ce44a74a3b052190cfacd4bd5ee6b92cfc620ac (patch) | |
tree | 6f178426c165f9136eb08354efa4a06c24725f87 /server/controllers/client.ts | |
parent | f07d6385b4b46c3254898292a8a53ed415b8d49b (diff) | |
download | PeerTube-7ce44a74a3b052190cfacd4bd5ee6b92cfc620ac.tar.gz PeerTube-7ce44a74a3b052190cfacd4bd5ee6b92cfc620ac.tar.zst PeerTube-7ce44a74a3b052190cfacd4bd5ee6b92cfc620ac.zip |
Add server localization
Diffstat (limited to 'server/controllers/client.ts')
-rw-r--r-- | server/controllers/client.ts | 7 |
1 files changed, 5 insertions, 2 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 } | |||
48 | clientsRouter.use('/client/assets/images', express.static(assetsImagesPath, { maxAge: STATIC_MAX_AGE })) | 48 | clientsRouter.use('/client/assets/images', express.static(assetsImagesPath, { maxAge: STATIC_MAX_AGE })) |
49 | 49 | ||
50 | clientsRouter.use('/client/locales/:locale/:file.json', function (req, res) { | 50 | clientsRouter.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) |