aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-31 18:12:15 +0200
committerChocobozzz <me@florianbigard.com>2018-06-05 08:43:01 +0200
commit989e526abf0c0dd7958deb630df009608561bb67 (patch)
tree5d948bf953a7006b1d6b8c34fb03da1df612a50f /scripts
parent1dd59831f80ff4d49f3b60c8c3b2aabfb1512eeb (diff)
downloadPeerTube-989e526abf0c0dd7958deb630df009608561bb67.tar.gz
PeerTube-989e526abf0c0dd7958deb630df009608561bb67.tar.zst
PeerTube-989e526abf0c0dd7958deb630df009608561bb67.zip
Prepare i18n files
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build/client.sh16
-rwxr-xr-xscripts/i18n/generate.sh11
-rwxr-xr-xscripts/i18n/pull-hook.sh7
-rwxr-xr-xscripts/release.sh2
4 files changed, 34 insertions, 2 deletions
diff --git a/scripts/build/client.sh b/scripts/build/client.sh
index 305af1e5f..61ba4ea99 100755
--- a/scripts/build/client.sh
+++ b/scripts/build/client.sh
@@ -6,5 +6,19 @@ cd client
6 6
7rm -rf ./dist ./compiled 7rm -rf ./dist ./compiled
8 8
9npm run ng build -- --prod --stats-json 9defaultLanguage="en-US"
10npm run ng build -- --output-path "dist/$defaultLanguage/" --deploy-url "/client/$defaultLanguage/" --prod --stats-json
11mv "./dist/$defaultLanguage/assets" "./dist"
12
13languages="fr"
14
15for lang in "$languages"; do
16 npm run ng build -- --prod --i18n-file "./src/locale/target/messages_$lang.xml" --i18n-format xlf --i18n-locale "$lang" \
17 --output-path "dist/$lang/" --deploy-url "/client/$lang/"
18
19 # Do no duplicate assets
20 rm -r "./dist/$lang/assets"
21done
22
10NODE_ENV=production npm run webpack -- --config webpack/webpack.video-embed.js --mode production 23NODE_ENV=production npm run webpack -- --config webpack/webpack.video-embed.js --mode production
24
diff --git a/scripts/i18n/generate.sh b/scripts/i18n/generate.sh
new file mode 100755
index 000000000..429523ba4
--- /dev/null
+++ b/scripts/i18n/generate.sh
@@ -0,0 +1,11 @@
1#!/bin/sh
2
3set -eu
4
5cd client
6npm run ng -- xi18n --i18n-locale "en-US" --output-path locale/source --out-file messages_en_US.xml
7npm run ngx-extractor -- --locale "en-US" -i 'src/**/*.ts' -f xlf -o src/locale/source/messages_en_US.xml
8
9# Zanata does not support inner elements in <source>, so we hack these special elements
10# This regex translate the Angular elements to special entities (that we will reconvert on pull)
11sed -i 's/<x id=\([^\/]\+\?\)\/>/\&lt;x id=\1\/\&gt;/g' src/locale/source/messages_en_US.xml \ No newline at end of file
diff --git a/scripts/i18n/pull-hook.sh b/scripts/i18n/pull-hook.sh
new file mode 100755
index 000000000..cb969f83c
--- /dev/null
+++ b/scripts/i18n/pull-hook.sh
@@ -0,0 +1,7 @@
1#!/bin/sh
2
3set -eu
4
5# Zanata does not support inner elements in <source>, so we hack these special elements
6# This regex translate the converted elements to initial Angular elements
7sed -i 's/\&lt;x id=\([^\/]\+\?\)\/\&gt;/<x id=\1\/>/g' client/src/locale/target/* \ No newline at end of file
diff --git a/scripts/release.sh b/scripts/release.sh
index 8c73a1fd6..393955264 100755
--- a/scripts/release.sh
+++ b/scripts/release.sh
@@ -57,7 +57,7 @@ git commit package.json client/package.json -m "Bumped to version $version"
57git tag -s -a "$version" -m "$version" 57git tag -s -a "$version" -m "$version"
58 58
59npm run build 59npm run build
60rm "./client/dist/stats.json" 60rm "./client/dist/en-US/stats.json"
61 61
62# Creating the archives 62# Creating the archives
63( 63(