]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - scripts/build/client.sh
8 mkdir "./src/pending_locale" > /dev
/null
|| true
9 mv .
/src
/locale
/angular.
*.xlf
"./src/pending_locale"
11 if [ ! -z ${1+x} ]; then
12 mv "./src/pending_locale/angular.$1.xlf" "./src/locale"
17 mv .
/src
/pending_locale
/* "./src/locale"
18 rmdir "./src/pending_locale/"
21 # Previous build failed
22 if [ ! -f "client/src/locale/angular.fr-FR.xlf" ]; then
23 git checkout
-- client
/src
/locale
/
24 rm -r client
/src
/pending_locale
29 rm -rf .
/dist .
/compiled
34 if [ ! -z ${1+x} ] && [ "$1" == "--analyze-bundle" ]; then
35 additionalParams
="--namedChunks=true --outputHashing=none"
36 export ANALYZE_BUNDLE
=true
40 defaultLanguage
="en-US"
41 npm run ng build
-- --output-path "dist/$defaultLanguage/" --deploy-url "/client/$defaultLanguage/" --prod --stats-json $additionalParams
42 mv "./dist/$defaultLanguage/assets" "./dist"
43 mv "./dist/$defaultLanguage/manifest.webmanifest" "./dist/manifest.webmanifest"
47 # Don't build other languages if --light arg is provided
48 if [ -z ${1+x} ] || ([ "$1" != "--light" ] && [ "$1" != "--analyze-bundle" ]); then
49 if [ ! -z ${1+x} ] && [ "$1" == "--light-hu" ]; then
50 languages
=(["hu"]="hu-HU")
51 elif [ ! -z ${1+x} ] && [ "$1" == "--light-ar" ]; then
52 languages
=(["ar"]="ar")
53 elif [ ! -z ${1+x} ] && [ "$1" == "--light-vi" ]; then
54 languages
=(["vi"]="vi-VN")
55 elif [ ! -z ${1+x} ] && [ "$1" == "--light-kab" ]; then
56 languages
=(["kab"]="kab")
57 elif [ ! -z ${1+x} ] && [ "$1" == "--light-th" ]; then
58 languages
=(["th"]="th-TH")
59 elif [ ! -z ${1+x} ] && [ "$1" == "--light-fi" ]; then
60 languages
=(["fi"]="fi-FI")
61 elif [ ! -z ${1+x} ] && [ "$1" == "--light-nl" ]; then
62 languages
=(["nl"]="nl-NL")
63 elif [ ! -z ${1+x} ] && [ "$1" == "--light-gd" ]; then
64 languages
=(["gd"]="gd")
65 elif [ ! -z ${1+x} ] && [ "$1" == "--light-el" ]; then
66 languages
=(["el"]="el-GR")
67 elif [ ! -z ${1+x} ] && [ "$1" == "--light-es" ]; then
68 languages
=(["es"]="es-ES")
69 elif [ ! -z ${1+x} ] && [ "$1" == "--light-oc" ]; then
70 languages
=(["oc"]="oc")
71 elif [ ! -z ${1+x} ] && [ "$1" == "--light-pt" ]; then
72 languages
=(["pt"]="pt-BR")
73 elif [ ! -z ${1+x} ] && [ "$1" == "--light-pt-PT" ]; then
74 languages
=(["pt-PT"]="pt-PT")
75 elif [ ! -z ${1+x} ] && [ "$1" == "--light-sv" ]; then
76 languages
=(["sv"]="sv-SE")
77 elif [ ! -z ${1+x} ] && [ "$1" == "--light-pl" ]; then
78 languages
=(["pl"]="pl-PL")
79 elif [ ! -z ${1+x} ] && [ "$1" == "--light-ru" ]; then
80 languages
=(["ru"]="ru-RU")
81 elif [ ! -z ${1+x} ] && [ "$1" == "--light-zh-Hans" ]; then
82 languages
=(["zh-Hans"]="zh-Hans-CN")
83 elif [ ! -z ${1+x} ] && [ "$1" == "--light-zh-Hant" ]; then
84 languages
=(["zh-Hant"]="zh-Hant-TW")
85 elif [ ! -z ${1+x} ] && [ "$1" == "--light-fr" ]; then
86 languages
=(["fr"]="fr-FR")
87 elif [ ! -z ${1+x} ] && [ "$1" == "--light-ja" ]; then
88 languages
=(["ja"]="ja-JP")
89 elif [ ! -z ${1+x} ] && [ "$1" == "--light-eu" ]; then
90 languages
=(["eu"]="eu-ES")
91 elif [ ! -z ${1+x} ] && [ "$1" == "--light-ca" ]; then
92 languages
=(["ca"]="ca-ES")
93 elif [ ! -z ${1+x} ] && [ "$1" == "--light-cs" ]; then
94 languages
=(["cs"]="cs-CZ")
95 elif [ ! -z ${1+x} ] && [ "$1" == "--light-eo" ]; then
96 languages
=(["eo"]="eo")
97 elif [ ! -z ${1+x} ] && [ "$1" == "--light-de" ]; then
98 languages
=(["de"]="de-DE")
99 elif [ ! -z ${1+x} ] && [ "$1" == "--light-it" ]; then
100 languages
=(["it"]="it-IT")
102 # Supported languages
119 ["zh-Hans"]="zh-Hans-CN"
120 ["zh-Hant"]="zh-Hant-TW"
133 for key
in "${!languages[@]}"; do
134 lang
=${languages[$key]}
136 # TODO: remove when the project will use runtime translations
137 pre_build_hook
"$lang"
139 npm run ng build
-- --prod --configuration="$lang" --output-path "dist/build"
141 # If --localize is not used
142 mv "dist/build/$key" "dist/$lang"
145 # If --localize is used
146 # if [ ! "$lang" = "$key" ]; then
147 # mv "dist/$key" "dist/$lang"
150 # Do not duplicate assets
151 rm -r "./dist/$lang/assets"
153 # TODO: remove when the project will use runtime translations
158 cd ..
/ && npm run build
:embed
&& cd client
/
160 # Copy runtime locales
161 cp -r "./src/locale" "./dist/locale"