2019-10-21 11:13:07 -04:00
|
|
|
import { registerTSPaths } from '../../server/helpers/register-ts-paths'
|
2019-11-07 03:45:14 -05:00
|
|
|
import { writeJSON } from 'fs-extra'
|
2018-06-06 08:23:40 -04:00
|
|
|
import { join } from 'path'
|
2018-08-03 04:26:47 -04:00
|
|
|
import {
|
|
|
|
buildLanguages,
|
|
|
|
VIDEO_CATEGORIES,
|
|
|
|
VIDEO_IMPORT_STATES,
|
2019-11-07 03:45:14 -05:00
|
|
|
VIDEO_LICENCES,
|
|
|
|
VIDEO_PLAYLIST_PRIVACIES,
|
|
|
|
VIDEO_PLAYLIST_TYPES,
|
2018-08-03 04:26:47 -04:00
|
|
|
VIDEO_PRIVACIES,
|
|
|
|
VIDEO_STATES
|
|
|
|
} from '../../server/initializers/constants'
|
2018-06-06 10:46:42 -04:00
|
|
|
import { values } from 'lodash'
|
2018-06-06 08:23:40 -04:00
|
|
|
|
2019-11-07 03:45:14 -05:00
|
|
|
registerTSPaths()
|
2018-06-06 08:23:40 -04:00
|
|
|
|
2019-11-07 03:45:14 -05:00
|
|
|
const videojs = require(join(__dirname, '../../../client/src/locale/videojs.en-US.json'))
|
2018-06-06 08:23:40 -04:00
|
|
|
const playerKeys = {
|
|
|
|
'Quality': 'Quality',
|
|
|
|
'Auto': 'Auto',
|
|
|
|
'Speed': 'Speed',
|
2018-07-13 12:21:19 -04:00
|
|
|
'Subtitles/CC': 'Subtitles/CC',
|
2018-06-06 08:23:40 -04:00
|
|
|
'peers': 'peers',
|
2019-01-29 02:37:25 -05:00
|
|
|
'peer': 'peer',
|
2018-06-06 08:23:40 -04:00
|
|
|
'Go to the video page': 'Go to the video page',
|
|
|
|
'Settings': 'Settings',
|
|
|
|
'Uses P2P, others may know you are watching this video.': 'Uses P2P, others may know you are watching this video.',
|
|
|
|
'Copy the video URL': 'Copy the video URL',
|
|
|
|
'Copy the video URL at the current time': 'Copy the video URL at the current time',
|
2019-01-29 02:37:25 -05:00
|
|
|
'Copy embed code': 'Copy embed code',
|
2019-02-15 04:57:59 -05:00
|
|
|
'Copy magnet URI': 'Copy magnet URI',
|
2019-01-29 02:37:25 -05:00
|
|
|
'Total downloaded: ': 'Total downloaded: ',
|
|
|
|
'Total uploaded: ': 'Total uploaded: '
|
2018-06-06 08:23:40 -04:00
|
|
|
}
|
2019-11-07 03:45:14 -05:00
|
|
|
Object.assign(playerKeys, videojs)
|
2018-06-06 08:23:40 -04:00
|
|
|
|
2018-06-06 10:46:42 -04:00
|
|
|
// Server keys
|
|
|
|
const serverKeys: any = {}
|
|
|
|
values(VIDEO_CATEGORIES)
|
|
|
|
.concat(values(VIDEO_LICENCES))
|
|
|
|
.concat(values(VIDEO_PRIVACIES))
|
2018-08-03 04:26:47 -04:00
|
|
|
.concat(values(VIDEO_STATES))
|
|
|
|
.concat(values(VIDEO_IMPORT_STATES))
|
2019-03-06 09:36:44 -05:00
|
|
|
.concat(values(VIDEO_PLAYLIST_PRIVACIES))
|
|
|
|
.concat(values(VIDEO_PLAYLIST_TYPES))
|
2019-01-14 11:45:02 -05:00
|
|
|
.concat([
|
|
|
|
'This video does not exist.',
|
|
|
|
'We cannot fetch the video. Please try again later.',
|
|
|
|
'Sorry',
|
|
|
|
'This video is not available because the remote instance is not responding.'
|
|
|
|
])
|
2018-06-06 10:46:42 -04:00
|
|
|
.forEach(v => serverKeys[v] = v)
|
|
|
|
|
|
|
|
// More keys
|
|
|
|
Object.assign(serverKeys, {
|
|
|
|
'Misc': 'Misc',
|
|
|
|
'Unknown': 'Unknown'
|
|
|
|
})
|
|
|
|
|
2018-06-13 09:55:13 -04:00
|
|
|
// ISO 639 keys
|
|
|
|
const languageKeys: any = {}
|
|
|
|
const languages = buildLanguages()
|
|
|
|
Object.keys(languages).forEach(k => languageKeys[languages[k]] = languages[k])
|
|
|
|
|
2019-11-07 03:45:14 -05:00
|
|
|
Object.assign(serverKeys, languageKeys)
|
2018-06-13 09:55:13 -04:00
|
|
|
|
2019-11-07 03:45:14 -05:00
|
|
|
Promise.all([
|
|
|
|
writeJSON(join(__dirname, '../../../client/src/locale/player.en-US.json'), playerKeys),
|
|
|
|
writeJSON(join(__dirname, '../../../client/src/locale/server.en-US.json'), serverKeys)
|
|
|
|
]).catch(err => {
|
2018-06-06 10:46:42 -04:00
|
|
|
console.error(err)
|
|
|
|
process.exit(-1)
|
2019-11-07 03:45:14 -05:00
|
|
|
})
|