diff options
author | Chocobozzz <me@florianbigard.com> | 2018-05-31 18:12:15 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-05 08:43:01 +0200 |
commit | 989e526abf0c0dd7958deb630df009608561bb67 (patch) | |
tree | 5d948bf953a7006b1d6b8c34fb03da1df612a50f /scripts | |
parent | 1dd59831f80ff4d49f3b60c8c3b2aabfb1512eeb (diff) | |
download | PeerTube-989e526abf0c0dd7958deb630df009608561bb67.tar.gz PeerTube-989e526abf0c0dd7958deb630df009608561bb67.tar.zst PeerTube-989e526abf0c0dd7958deb630df009608561bb67.zip |
Prepare i18n files
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build/client.sh | 16 | ||||
-rwxr-xr-x | scripts/i18n/generate.sh | 11 | ||||
-rwxr-xr-x | scripts/i18n/pull-hook.sh | 7 | ||||
-rwxr-xr-x | scripts/release.sh | 2 |
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 | ||
7 | rm -rf ./dist ./compiled | 7 | rm -rf ./dist ./compiled |
8 | 8 | ||
9 | npm run ng build -- --prod --stats-json | 9 | defaultLanguage="en-US" |
10 | npm run ng build -- --output-path "dist/$defaultLanguage/" --deploy-url "/client/$defaultLanguage/" --prod --stats-json | ||
11 | mv "./dist/$defaultLanguage/assets" "./dist" | ||
12 | |||
13 | languages="fr" | ||
14 | |||
15 | for 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" | ||
21 | done | ||
22 | |||
10 | NODE_ENV=production npm run webpack -- --config webpack/webpack.video-embed.js --mode production | 23 | NODE_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 | |||
3 | set -eu | ||
4 | |||
5 | cd client | ||
6 | npm run ng -- xi18n --i18n-locale "en-US" --output-path locale/source --out-file messages_en_US.xml | ||
7 | npm 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) | ||
11 | sed -i 's/<x id=\([^\/]\+\?\)\/>/\<x id=\1\/\>/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 | |||
3 | set -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 | ||
7 | sed -i 's/\<x id=\([^\/]\+\?\)\/\>/<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" | |||
57 | git tag -s -a "$version" -m "$version" | 57 | git tag -s -a "$version" -m "$version" |
58 | 58 | ||
59 | npm run build | 59 | npm run build |
60 | rm "./client/dist/stats.json" | 60 | rm "./client/dist/en-US/stats.json" |
61 | 61 | ||
62 | # Creating the archives | 62 | # Creating the archives |
63 | ( | 63 | ( |