aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/i18n/create-custom-files.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-06 14:23:40 +0200
committerChocobozzz <me@florianbigard.com>2018-06-06 16:48:40 +0200
commite945b184a0f29b47c33bbd05578f3493ca9c8e6c (patch)
tree46c821006d170e6e28658d978e313761adfaf55a /scripts/i18n/create-custom-files.ts
parent550a562ceca45ea78d6f7054024c8d3a6b89c30c (diff)
downloadPeerTube-e945b184a0f29b47c33bbd05578f3493ca9c8e6c.tar.gz
PeerTube-e945b184a0f29b47c33bbd05578f3493ca9c8e6c.tar.zst
PeerTube-e945b184a0f29b47c33bbd05578f3493ca9c8e6c.zip
Localize player
Diffstat (limited to 'scripts/i18n/create-custom-files.ts')
-rwxr-xr-xscripts/i18n/create-custom-files.ts49
1 files changed, 49 insertions, 0 deletions
diff --git a/scripts/i18n/create-custom-files.ts b/scripts/i18n/create-custom-files.ts
new file mode 100755
index 000000000..3895b3b9d
--- /dev/null
+++ b/scripts/i18n/create-custom-files.ts
@@ -0,0 +1,49 @@
1import * as jsToXliff12 from 'xliff/jsToXliff12'
2import { writeFile } from 'fs'
3import { join } from 'path'
4
5// First, the player
6const playerSource = join(__dirname, '../../../client/src/locale/source/videojs_en_US.json')
7const playerTarget = join(__dirname, '../../../client/src/locale/source/player_en_US.xml')
8
9const videojs = require(playerSource)
10const playerKeys = {
11 'Quality': 'Quality',
12 'Auto': 'Auto',
13 'Speed': 'Speed',
14 'peers': 'peers',
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'
21}
22
23const obj = {
24 resources: {
25 namespace1: {}
26 }
27}
28
29for (const sourceObject of [ videojs, playerKeys ]) {
30 Object.keys(sourceObject).forEach(k => obj.resources.namespace1[ k ] = { source: sourceObject[ k ] })
31}
32
33jsToXliff12(obj, (err, res) => {
34 if (err) {
35 console.error(err)
36 process.exit(-1)
37 }
38
39 writeFile(playerTarget, res, err => {
40 if (err) {
41 console.error(err)
42 process.exit(-1)
43 }
44
45 process.exit(0)
46 })
47})
48
49// Then, the server strings