aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/build/client.sh
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-25 09:57:52 +0200
committerChocobozzz <me@florianbigard.com>2018-07-25 09:57:52 +0200
commitd73c98884ec7f970ed95a01fb2d445d10c53c817 (patch)
tree150d13e61a6954ea6393788c4fe2de3b28392fac /scripts/build/client.sh
parenta8bf1d826e379dec03d25840c7c49c1f30168380 (diff)
downloadPeerTube-d73c98884ec7f970ed95a01fb2d445d10c53c817.tar.gz
PeerTube-d73c98884ec7f970ed95a01fb2d445d10c53c817.tar.zst
PeerTube-d73c98884ec7f970ed95a01fb2d445d10c53c817.zip
Hack 459 regarding Angular & i18n
Diffstat (limited to 'scripts/build/client.sh')
-rwxr-xr-xscripts/build/client.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/build/client.sh b/scripts/build/client.sh
index e4d053e82..567a6e5e0 100755
--- a/scripts/build/client.sh
+++ b/scripts/build/client.sh
@@ -2,25 +2,49 @@
2 2
3set -eu 3set -eu
4 4
5pre_build_hook () {
6 mkdir "./src/locale/pending_target/" > /dev/null || true
7 mv ./src/locale/target/angular_*.xml "./src/locale/pending_target"
8
9 if [ ! -z ${1+x} ]; then
10 mv "./src/locale/pending_target/angular_$1.xml" "./src/locale/target"
11 fi
12}
13
14post_build_hook () {
15 mv ./src/locale/pending_target/* "./src/locale/target/"
16 rmdir "./src/locale/pending_target/"
17}
18
5cd client 19cd client
6 20
7rm -rf ./dist ./compiled 21rm -rf ./dist ./compiled
8 22
23pre_build_hook
24
9defaultLanguage="en_US" 25defaultLanguage="en_US"
10npm run ng build -- --output-path "dist/$defaultLanguage/" --deploy-url "/client/$defaultLanguage/" --prod --stats-json 26npm run ng build -- --output-path "dist/$defaultLanguage/" --deploy-url "/client/$defaultLanguage/" --prod --stats-json
11mv "./dist/$defaultLanguage/assets" "./dist" 27mv "./dist/$defaultLanguage/assets" "./dist"
12 28
29post_build_hook
30
13# Don't build other languages if --light arg is provided 31# Don't build other languages if --light arg is provided
14if [ -z ${1+x} ] || [ "$1" != "--light" ]; then 32if [ -z ${1+x} ] || [ "$1" != "--light" ]; then
15 # Supported languages 33 # Supported languages
16 languages=("fr_FR" "eu_ES" "ca_ES" "cs_CZ" "eo") 34 languages=("fr_FR" "eu_ES" "ca_ES" "cs_CZ" "eo")
17 35
18 for lang in "${languages[@]}"; do 36 for lang in "${languages[@]}"; do
37 # TODO: remove when the project will use runtime translations
38 pre_build_hook "$lang"
39
19 npm run ng build -- --prod --i18n-file "./src/locale/target/angular_$lang.xml" --i18n-format xlf --i18n-locale "$lang" \ 40 npm run ng build -- --prod --i18n-file "./src/locale/target/angular_$lang.xml" --i18n-format xlf --i18n-locale "$lang" \
20 --output-path "dist/$lang/" --deploy-url "/client/$lang/" 41 --output-path "dist/$lang/" --deploy-url "/client/$lang/"
21 42
22 # Do no duplicate assets 43 # Do no duplicate assets
23 rm -r "./dist/$lang/assets" 44 rm -r "./dist/$lang/assets"
45
46 # TODO: remove when the project will use runtime translations
47 post_build_hook
24 done 48 done
25fi 49fi
26 50