1 import * as jsToXliff12 from 'xliff/jsToXliff12'
2 import { writeFile } from 'fs'
3 import { join } from 'path'
6 const playerSource = join(__dirname, '../../../client/src/locale/source/videojs_en_US.json')
7 const playerTarget = join(__dirname, '../../../client/src/locale/source/player_en_US.xml')
9 const videojs = require(playerSource)
15 'Go to the video page': 'Go to the video page',
16 'Settings': 'Settings',
17 'Uses P2P, others may know you are watching this video.': 'Uses P2P, others may know you are watching this video.',
18 'Copy the video URL': 'Copy the video URL',
19 'Copy the video URL at the current time': 'Copy the video URL at the current time',
20 'Copy embed code': 'Copy embed code'
29 for (const sourceObject of [ videojs, playerKeys ]) {
30 Object.keys(sourceObject).forEach(k => obj.resources.namespace1[ k ] = { source: sourceObject[ k ] })
33 saveToXliffFile(playerTarget, obj, err => {
42 // Then, the server strings
44 function saveToXliffFile (targetPath: string, obj: any, cb: Function) {
45 jsToXliff12(obj, (err, res) => {
46 if (err) return cb(err)
48 writeFile(playerTarget, res, err => {
49 if (err) return cb(err)