aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xscripts/build/client.sh24
-rw-r--r--server/controllers/client.ts2
2 files changed, 25 insertions, 1 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
diff --git a/server/controllers/client.ts b/server/controllers/client.ts
index bbb518c1b..c33061289 100644
--- a/server/controllers/client.ts
+++ b/server/controllers/client.ts
@@ -89,7 +89,7 @@ export {
89// --------------------------------------------------------------------------- 89// ---------------------------------------------------------------------------
90 90
91async function generateHTMLPage (req: express.Request, res: express.Response, paramLang?: string) { 91async function generateHTMLPage (req: express.Request, res: express.Response, paramLang?: string) {
92 const html = await ClientHtml.getIndexHTML(req, res) 92 const html = await ClientHtml.getIndexHTML(req, res, paramLang)
93 93
94 return sendHTML(html, res) 94 return sendHTML(html, res)
95} 95}