1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 09:49:20 +02:00

Update all player/server translation files

This commit is contained in:
Chocobozzz 2025-05-30 10:50:43 +02:00
parent d84c65e90e
commit 571334eb02
No known key found for this signature in database
GPG key ID: 583A612D890159BE
41 changed files with 1997 additions and 52 deletions

View file

@ -18,6 +18,7 @@ import {
USER_IMPORT_STATES,
VIDEO_STATES
} from '@peertube/peertube-server/core/initializers/constants.js'
import { readdir } from 'fs/promises'
const videojs = readJsonSync(join(root(), 'client', 'src', 'locale', 'videojs.en-US.json'))
const playerKeys = {
@ -150,17 +151,21 @@ async function writeAll () {
await writeJSON(join(localePath, 'player.en-US.json'), playerKeys, { spaces: 4 })
await writeJSON(join(localePath, 'server.en-US.json'), serverKeys, { spaces: 4 })
for (const key of Object.keys(I18N_LOCALES)) {
const playerJsonPath = join(localePath, `player.${key}.json`)
const translatedPlayer = readJsonSync(playerJsonPath)
for (const file of await readdir(localePath)) {
if (file.match(/^player\.[^.]+\.json$/)) {
const playerJsonPath = join(localePath, file)
const translatedPlayer = readJsonSync(playerJsonPath)
const newTranslatedPlayer = Object.assign({}, playerKeys, translatedPlayer)
await writeJSON(playerJsonPath, newTranslatedPlayer, { spaces: 4 })
const newTranslatedPlayer = Object.assign({}, playerKeys, translatedPlayer)
await writeJSON(playerJsonPath, newTranslatedPlayer, { spaces: 4 })
}
const serverJsonPath = join(localePath, `server.${key}.json`)
const translatedServer = readJsonSync(serverJsonPath)
if (file.match(/^server\.[^.]+\.json$/)) {
const serverJsonPath = join(localePath, file)
const translatedServer = readJsonSync(serverJsonPath)
const newTranslatedServer = Object.assign({}, serverKeys, translatedServer)
await writeJSON(serverJsonPath, newTranslatedServer, { spaces: 4 })
const newTranslatedServer = Object.assign({}, serverKeys, translatedServer)
await writeJSON(serverJsonPath, newTranslatedServer, { spaces: 4 })
}
}
}