]>
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
39 if [ ! -z ${1+x} ] && [ "$1" == "--i18n" ]; then
40 additionalParams
="--configuration=i18n"
41 export ANALYZE_BUNDLE
=true
44 defaultLanguage
="en-US"
45 npm run ng build
-- --output-path "dist/$defaultLanguage/" --deploy-url "/client/$defaultLanguage/" --prod --stats-json $additionalParams
46 mv "./dist/$defaultLanguage/assets" "./dist"
47 mv "./dist/$defaultLanguage/manifest.webmanifest" "./dist/manifest.webmanifest"
51 # Don't build other languages if --light arg is provided
52 if [ -z ${1+x} ] || ([ "$1" != "--light" ] && [ "$1" != "--analyze-bundle" ] && [ "$1" != "--i18n" ]); then
53 if [ ! -z ${1+x} ] && [ "$1" == "--light-hu" ]; then
54 languages
=(["hu"]="hu-HU")
55 elif [ ! -z ${1+x} ] && [ "$1" == "--light-ar" ]; then
56 languages
=(["ar"]="ar")
57 elif [ ! -z ${1+x} ] && [ "$1" == "--light-vi" ]; then
58 languages
=(["vi"]="vi-VN")
59 elif [ ! -z ${1+x} ] && [ "$1" == "--light-kab" ]; then
60 languages
=(["kab"]="kab")
61 elif [ ! -z ${1+x} ] && [ "$1" == "--light-th" ]; then
62 languages
=(["th"]="th-TH")
63 elif [ ! -z ${1+x} ] && [ "$1" == "--light-fi" ]; then
64 languages
=(["fi"]="fi-FI")
65 elif [ ! -z ${1+x} ] && [ "$1" == "--light-nl" ]; then
66 languages
=(["nl"]="nl-NL")
67 elif [ ! -z ${1+x} ] && [ "$1" == "--light-gd" ]; then
68 languages
=(["gd"]="gd")
69 elif [ ! -z ${1+x} ] && [ "$1" == "--light-el" ]; then
70 languages
=(["el"]="el-GR")
71 elif [ ! -z ${1+x} ] && [ "$1" == "--light-es" ]; then
72 languages
=(["es"]="es-ES")
73 elif [ ! -z ${1+x} ] && [ "$1" == "--light-oc" ]; then
74 languages
=(["oc"]="oc")
75 elif [ ! -z ${1+x} ] && [ "$1" == "--light-pt" ]; then
76 languages
=(["pt"]="pt-BR")
77 elif [ ! -z ${1+x} ] && [ "$1" == "--light-pt-PT" ]; then
78 languages
=(["pt-PT"]="pt-PT")
79 elif [ ! -z ${1+x} ] && [ "$1" == "--light-sv" ]; then
80 languages
=(["sv"]="sv-SE")
81 elif [ ! -z ${1+x} ] && [ "$1" == "--light-pl" ]; then
82 languages
=(["pl"]="pl-PL")
83 elif [ ! -z ${1+x} ] && [ "$1" == "--light-ru" ]; then
84 languages
=(["ru"]="ru-RU")
85 elif [ ! -z ${1+x} ] && [ "$1" == "--light-zh-Hans" ]; then
86 languages
=(["zh-Hans"]="zh-Hans-CN")
87 elif [ ! -z ${1+x} ] && [ "$1" == "--light-zh-Hant" ]; then
88 languages
=(["zh-Hant"]="zh-Hant-TW")
89 elif [ ! -z ${1+x} ] && [ "$1" == "--light-fr" ]; then
90 languages
=(["fr"]="fr-FR")
91 elif [ ! -z ${1+x} ] && [ "$1" == "--light-ja" ]; then
92 languages
=(["ja"]="ja-JP")
93 elif [ ! -z ${1+x} ] && [ "$1" == "--light-eu" ]; then
94 languages
=(["eu"]="eu-ES")
95 elif [ ! -z ${1+x} ] && [ "$1" == "--light-ca" ]; then
96 languages
=(["ca"]="ca-ES")
97 elif [ ! -z ${1+x} ] && [ "$1" == "--light-cs" ]; then
98 languages
=(["cs"]="cs-CZ")
99 elif [ ! -z ${1+x} ] && [ "$1" == "--light-eo" ]; then
100 languages
=(["eo"]="eo")
101 elif [ ! -z ${1+x} ] && [ "$1" == "--light-de" ]; then
102 languages
=(["de"]="de-DE")
103 elif [ ! -z ${1+x} ] && [ "$1" == "--light-it" ]; then
104 languages
=(["it"]="it-IT")
106 # Supported languages
123 ["zh-Hans"]="zh-Hans-CN"
124 ["zh-Hant"]="zh-Hant-TW"
137 for key
in "${!languages[@]}"; do
138 lang
=${languages[$key]}
140 # TODO: remove when the project will use runtime translations
141 pre_build_hook
"$lang"
143 npm run ng build
-- --prod --configuration="$lang" --output-path "dist/build"
145 # If --localize is not used
146 mv "dist/build/$key" "dist/$lang"
149 # If --localize is used
150 # if [ ! "$lang" = "$key" ]; then
151 # mv "dist/$key" "dist/$lang"
154 # Do not duplicate assets
155 rm -r "./dist/$lang/assets"
157 # TODO: remove when the project will use runtime translations
162 cd ..
/ && npm run build
:embed
&& cd client
/
164 # Copy runtime locales
165 cp -r "./src/locale" "./dist/locale"