aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/build/client.sh
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-02-07 15:51:19 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-02-10 16:39:28 +0100
commit361dcebc75dea74947b6c3aafd9d7d720c054b01 (patch)
tree5edf2a0d871097ba7da2b974b8ccdef9c6b73261 /scripts/build/client.sh
parentf77eb73b5e02bed9e223dafc1c203ceb7c05b6e5 (diff)
downloadPeerTube-361dcebc75dea74947b6c3aafd9d7d720c054b01.tar.gz
PeerTube-361dcebc75dea74947b6c3aafd9d7d720c054b01.tar.zst
PeerTube-361dcebc75dea74947b6c3aafd9d7d720c054b01.zip
Support i18n build
Diffstat (limited to 'scripts/build/client.sh')
-rwxr-xr-xscripts/build/client.sh40
1 files changed, 33 insertions, 7 deletions
diff --git a/scripts/build/client.sh b/scripts/build/client.sh
index ee647bb99..99394838a 100755
--- a/scripts/build/client.sh
+++ b/scripts/build/client.sh
@@ -2,6 +2,8 @@
2 2
3set -eu 3set -eu
4 4
5declare -A languages
6
5pre_build_hook () { 7pre_build_hook () {
6 mkdir "./src/pending_locale" > /dev/null || true 8 mkdir "./src/pending_locale" > /dev/null || true
7 mv ./src/locale/angular.*.xlf "./src/pending_locale" 9 mv ./src/locale/angular.*.xlf "./src/pending_locale"
@@ -38,22 +40,46 @@ post_build_hook
38# Don't build other languages if --light arg is provided 40# Don't build other languages if --light arg is provided
39if [ -z ${1+x} ] || [ "$1" != "--light" ]; then 41if [ -z ${1+x} ] || [ "$1" != "--light" ]; then
40 if [ ! -z ${1+x} ] && [ "$1" == "--light-fr" ]; then 42 if [ ! -z ${1+x} ] && [ "$1" == "--light-fr" ]; then
41 languages=("fr-FR") 43 languages=(["fr"]="fr-FR")
42 else 44 else
43 # Supported languages 45 # Supported languages
44 languages=( 46 languages=(
45 "hu-HU" "th-TH" 47 ["hu"]="hu-HU"
46 "fi-FI" "nl-NL" "gd" "el-GR" "es-ES" "oc" "pt-BR" "pt-PT" "sv-SE" "pl-PL" "ru-RU" "zh-Hans-CN" "zh-Hant-TW" 48 ["th"]="th-TH"
47 "fr-FR" "ja-JP" "eu-ES" "ca-ES" "cs-CZ" "eo" "de-DE" "it-IT" 49 ["fi"]="fi-FI"
50 ["nl"]="nl-NL"
51 ["gd"]="gd"
52 ["el"]="el-GR"
53 ["es"]="es-ES"
54 ["oc"]="oc"
55 ["pt"]="pt-BR"
56 ["pt-PT"]="pt-PT"
57 ["sv"]="sv-SE"
58 ["pl"]="pl-PL"
59 ["ru"]="ru-RU"
60 ["zh-Hans"]="zh-Hans-CN"
61 ["zh-Hant"]="zh-Hant-TW"
62 ["fr"]="fr-FR"
63 ["ja"]="ja-JP"
64 ["eu"]="eu-ES"
65 ["ca"]="ca-ES"
66 ["cs"]="cs-CZ"
67 ["eo"]="eo"
68 ["de"]="de-DE"
69 ["it"]="it-IT"
48 ) 70 )
49 fi 71 fi
50 72
51 for lang in "${languages[@]}"; do 73 for key in "${!languages[@]}"; do
74 lang=${languages[$key]}
75
52 # TODO: remove when the project will use runtime translations 76 # TODO: remove when the project will use runtime translations
53 pre_build_hook "$lang" 77 pre_build_hook "$lang"
54 78
55 npm run ng build -- --prod --i18n-file "./src/locale/angular.$lang.xlf" --i18n-format xlf --i18n-locale "$lang" \ 79 npm run ng build -- --output-path "dist/build" --deploy-url "/client/$lang/" --prod --configuration="$lang"
56 --output-path "dist/$lang/" --deploy-url "/client/$lang/" 80
81 mv "dist/build/$key" "dist/$lang"
82 rmdir "dist/build"
57 83
58 # Do not duplicate assets 84 # Do not duplicate assets
59 rm -r "./dist/$lang/assets" 85 rm -r "./dist/$lang/assets"