ActivityPub-federated video streaming platform using P2P directly in your web browser
Remove unused files
Chocobozzzcd1d6c23dae0
diff --git a/scripts/i18n/pull-hook.sh b/scripts/i18n/pull-hook.shdeleted file mode 100755index 66f3b4588a..0000000000--- a/scripts/i18n/pull-hook.sh+++ /dev/null@@ -1,12 +0,0 @@-#!/bin/sh--set -eu--for i in $(seq 1 10); do- # Zanata does not support inner elements in <source>, so we hack these special elements- # This regex translate the converted elements to initial Angular elements- perl -pi -e 's|<x id=(.+?)/>([^"])|<x id=\1/>\2|g' client/src/locale/target/*.xml-done--npm run i18n:xliff2json-diff --git a/scripts/i18n/xliff2json.ts b/scripts/i18n/xliff2json.tsdeleted file mode 100755index d15039bb92..0000000000--- a/scripts/i18n/xliff2json.ts+++ /dev/null@@ -1,179 +0,0 @@-import { registerTSPaths } from '../../server/helpers/register-ts-paths'-registerTSPaths()--import * as xliff12ToJs from 'xliff/xliff12ToJs'-import { readFileSync, readJSON, unlink, writeFile, writeJSON, existsSync, exists, pathExists } from 'fs-extra'-import { join } from 'path'-import { buildFileLocale, I18N_LOCALES, isDefaultLocale } from '../../shared/models/i18n/i18n'-import { eachSeries } from 'async'--const sources: string[] = []-const l = [- 'ar-001',- 'ca-ES',- 'cs-CZ',- 'da-DK',- 'de-DE',- 'el-GR',- 'en-GB',- 'en-US',- 'eo',- 'es-ES',- 'eu-ES',- 'fa-IR',- 'fi-FI',- 'fr-FR',- 'gd',- 'gl-ES',- 'hu-HU',- 'it-IT',- 'ja-JP',- 'jbo',- 'ko-KR',- 'lt-LT',- 'nb-NO',- 'nl-NL',- 'oc',- 'pl-PL',- 'pt-BR',- 'pt-PT',- 'ru-RU',- 'sk-SK',- 'sl-SI',- 'sv-SE',- 'ta',- 'th-TH',- 'tr-TR',- 'uk-UA',- 'vi-VN',- 'zh-Hans-CN',- 'zh-Hant-TW'-]--const availableLocales = l.filter(l => isDefaultLocale(l) === false)- .map(l => buildFileLocale(l))--for (const file of [ 'player', 'server', 'iso639' ]) {- for (const locale of availableLocales) {- sources.push(join(__dirname, '../../../client/src/locale/target/', `${file}_${locale}.xml`))- }-}--eachSeries(sources, (source, cb) => {- xliffFile2JSON(source, cb)-}, err => {- if (err) return handleError(err)-- mergeISO639InServer(err => {- if (err) return handleError(err)-- injectMissingTranslations().then(() => process.exit(0))- })-})--function handleError (err: any) {- console.error(err)- process.exit(-1)-}--function xliffFile2JSON (filePath: string, cb) {- const fileTarget = filePath.replace('.xml', '.json')-- if (!existsSync(filePath)) {- console.log('No file %s exists.', filePath)- return cb()- }-- // Remove the two first lines our xliff module does not like- let fileContent = readFileSync(filePath).toString()- fileContent = removeFirstLine(fileContent)- fileContent = removeFirstLine(fileContent)-- xliff12ToJs(fileContent, (err, res) => {- if (err) return cb(err)-- const json = createJSONString(res)- writeFile(fileTarget, json, err => {- if (err) return cb(err)-- return unlink(filePath, cb)- })- })-}--function mergeISO639InServer (cb) {- eachSeries(availableLocales, (locale, eachCallback) => {- const serverPath = join(__dirname, '../../../client/src/locale/target/', `server_${locale}.json`)- const iso639Path = join(__dirname, '../../../client/src/locale/target/', `iso639_${locale}.json`)-- if (!existsSync(serverPath)) {- console.log('No file %s exists.', serverPath)- return cb()- }- if (!existsSync(iso639Path)) {- console.log('No file %s exists.', iso639Path)- return cb()- }-- const resServer = readFileSync(serverPath).toString()- const resISO639 = readFileSync(iso639Path).toString()-- const jsonServer = JSON.parse(resServer)- const jsonISO639 = JSON.parse(resISO639)-- Object.assign(jsonServer, jsonISO639)- const serverString = JSON.stringify(jsonServer)-- writeFile(serverPath, serverString, err => {- if (err) return eachCallback(err)-- return unlink(iso639Path, eachCallback)- })- }, cb)-}--function removeFirstLine (str: string) {- return str.substring(str.indexOf('\n') + 1)-}--function createJSONString (obj: any) {- const res: any = {}- const strings = obj.resources['']-- Object.keys(strings).forEach(k => res[k] = strings[k].target)-- return JSON.stringify(res)-}--async function injectMissingTranslations () {- const baseServer = await readJSON(join(__dirname, '../../../client/src/locale/server.en-US.json'))- Object.keys(baseServer).forEach(k => baseServer[k] = '')-- for (const locale of availableLocales) {- const serverPath = join(__dirname, '../../../client/src/locale/target/', `server_${locale}.json`)- if (!await pathExists(serverPath)) {- console.log('No file exists to inject missing translations: %s.', serverPath)- continue- }-- let serverJSON = await readJSON(serverPath)-- serverJSON = Object.assign({}, baseServer, serverJSON)- await writeJSON(serverPath, serverJSON)- }-- const basePlayer = await readJSON(join(__dirname, '../../../client/src/locale/player.en-US.json'))- Object.keys(basePlayer).forEach(k => basePlayer[k] = '')- for (const locale of availableLocales) {- const serverPath = join(__dirname, '../../../client/src/locale/target/', `player_${locale}.json`)- if (!await pathExists(serverPath)) {- console.log('No file exists to inject missing translations: %s.', serverPath)- continue- }-- let serverJSON = await readJSON(serverPath)-- serverJSON = Object.assign({}, basePlayer, serverJSON)- await writeJSON(serverPath, serverJSON)- }-}diff --git a/support/doc/translation.md b/support/doc/translation.mdindex 58b52f5f80..1a3e59f9fd 100644--- a/support/doc/translation.md+++ b/support/doc/translation.md@@ -1,17 +1,19 @@# Translation-We use [Zanata](http://zanata.org/) as translation platform.-Please do not edit xml files directly from Git, you have to use Zanata!+We use [Weblate](https://weblate.org) as translation platform.+Please do not edit translation files directly from Git, you have to use Weblate!-If you don't see your locale in the platform, please [create an issue](https://github.com/Chocobozzz/PeerTube/issues) so we add it!+If you don't see your locale in the platform you can add it directly in the Weblate interface.+Then, if you think there are enough translated strings, please [create an issue](https://github.com/Chocobozzz/PeerTube/issues) so we add the new locale in PeerTube!## How to- * Create an account: https://trad.framasoft.org/account/register- * Join a language team: https://trad.framasoft.org/languages- * Go to the PeerTube page https://trad.framasoft.org/iteration/view/peertube/develop- * Choose the locale and begin to translate PeerTube!+ * Create an account: https://weblate.framasoft.org/accounts/register/+ * Validate your email and follow the link sent+ * Create your password (keep the `Current password` field empty) and setup your account+ * Go to the PeerTube page https://weblate.framasoft.org/projects/peertube/+ * Choose the file and the locale you want to translate## Files@@ -20,10 +22,10 @@ There are 4 files:* **angular**: contains client strings* **player**: contains player strings.Most of the strings come from VideoJS, so you can help yourself by using [video.js JSON files](https://github.com/videojs/video.js/tree/master/lang)- * **server**: contains server strings (privacies, licences...)- * **iso639**: contains iso639 (languages) strings used by PeerTube to describe the audio language of a particular video.+ * **server**: contains server strings (privacies, licences...) and iso639 (languages) strings used by PeerTube to describe the audio language of a particular video.It's the reason why these strings should be translated too. There are many strings so do not hesitate to translate only main audio languages.+## Tips### Special tags@@ -39,7 +41,7 @@ should be in french### Singular/plural-For singular/plural translations, you must translate values inside `{` and `}`.+For singular/plural translations, you must translate values inside `{` and `}`. **Please don't translate the word *other***For example:diff --git a/zanata.xml b/zanata.xmldeleted file mode 100644index f1148cd6e7..0000000000--- a/zanata.xml+++ /dev/null@@ -1,15 +0,0 @@-<?xml version='1.0' encoding='UTF-8' standalone='yes'?>-<config xmlns="http://zanata.org/namespace/config/">- <url>https://trad.framasoft.org/</url>- <project>peertube</project>- <project-version>develop</project-version>- <project-type>xliff</project-type>- <src-dir>./client/src/locale/source</src-dir>- <trans-dir>./client/src/locale/target</trans-dir>-- <hooks>- <hook command="pull">- <after>./scripts/i18n/pull-hook.sh</after>- </hook>- </hooks>-</config>