]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - scripts/i18n/create-custom-files.ts
Regenerate translations
[github/Chocobozzz/PeerTube.git] / scripts / i18n / create-custom-files.ts
CommitLineData
2aaa1a3f 1import { registerTSPaths } from '../../server/helpers/register-ts-paths'
3aea8eb2 2import { writeJSON } from 'fs-extra'
e945b184 3import { join } from 'path'
7e5f9f00
C
4import {
5 buildLanguages,
6 VIDEO_CATEGORIES,
7 VIDEO_IMPORT_STATES,
3aea8eb2
C
8 VIDEO_LICENCES,
9 VIDEO_PLAYLIST_PRIVACIES,
10 VIDEO_PLAYLIST_TYPES,
7e5f9f00
C
11 VIDEO_PRIVACIES,
12 VIDEO_STATES
13} from '../../server/initializers/constants'
7ce44a74 14import { values } from 'lodash'
e945b184 15
3aea8eb2 16registerTSPaths()
e945b184 17
3aea8eb2 18const videojs = require(join(__dirname, '../../../client/src/locale/videojs.en-US.json'))
e945b184
C
19const playerKeys = {
20 'Quality': 'Quality',
21 'Auto': 'Auto',
22 'Speed': 'Speed',
16f7022b 23 'Subtitles/CC': 'Subtitles/CC',
e945b184 24 'peers': 'peers',
09209296 25 'peer': 'peer',
e945b184
C
26 'Go to the video page': 'Go to the video page',
27 'Settings': 'Settings',
d28d1358 28 'Watching this video may reveal your IP address to others.': 'Watching this video may reveal your IP address to others.',
e945b184
C
29 'Copy the video URL': 'Copy the video URL',
30 'Copy the video URL at the current time': 'Copy the video URL at the current time',
09209296 31 'Copy embed code': 'Copy embed code',
37c6bb36 32 'Copy magnet URI': 'Copy magnet URI',
09209296
C
33 'Total downloaded: ': 'Total downloaded: ',
34 'Total uploaded: ': 'Total uploaded: '
e945b184 35}
3aea8eb2 36Object.assign(playerKeys, videojs)
e945b184 37
7ce44a74
C
38// Server keys
39const serverKeys: any = {}
40values(VIDEO_CATEGORIES)
41 .concat(values(VIDEO_LICENCES))
42 .concat(values(VIDEO_PRIVACIES))
7e5f9f00
C
43 .concat(values(VIDEO_STATES))
44 .concat(values(VIDEO_IMPORT_STATES))
830b4faf
C
45 .concat(values(VIDEO_PLAYLIST_PRIVACIES))
46 .concat(values(VIDEO_PLAYLIST_TYPES))
ad3fa0c5
C
47 .concat([
48 'This video does not exist.',
49 'We cannot fetch the video. Please try again later.',
50 'Sorry',
5abc96fc
C
51 'This video is not available because the remote instance is not responding.',
52 'This playlist does not exist',
4572c3d0
C
53 'We cannot fetch the playlist. Please try again later.',
54 'Playlist: {1}',
56674bb9
C
55 'By {1}',
56 'Unavailable video'
ad3fa0c5 57 ])
f0af38e6 58 .forEach(v => { serverKeys[v] = v })
7ce44a74 59
7ce44a74
C
60// More keys
61Object.assign(serverKeys, {
f0af38e6
C
62 Misc: 'Misc',
63 Unknown: 'Unknown'
7ce44a74
C
64})
65
850c1bf7
C
66// ISO 639 keys
67const languageKeys: any = {}
68const languages = buildLanguages()
f0af38e6 69Object.keys(languages).forEach(k => { languageKeys[languages[k]] = languages[k] })
850c1bf7 70
3aea8eb2 71Object.assign(serverKeys, languageKeys)
850c1bf7 72
3aea8eb2
C
73Promise.all([
74 writeJSON(join(__dirname, '../../../client/src/locale/player.en-US.json'), playerKeys),
75 writeJSON(join(__dirname, '../../../client/src/locale/server.en-US.json'), serverKeys)
76]).catch(err => {
7ce44a74
C
77 console.error(err)
78 process.exit(-1)
3aea8eb2 79})