Prepare i18n files

This commit is contained in:
Chocobozzz
2018-05-31 18:12:15 +02:00
parent 1dd59831f8
commit 989e526abf
28 changed files with 853 additions and 166 deletions

View File

@@ -6,5 +6,19 @@ cd client
rm -rf ./dist ./compiled
npm run ng build -- --prod --stats-json
defaultLanguage="en-US"
npm run ng build -- --output-path "dist/$defaultLanguage/" --deploy-url "/client/$defaultLanguage/" --prod --stats-json
mv "./dist/$defaultLanguage/assets" "./dist"
languages="fr"
for lang in "$languages"; do
npm run ng build -- --prod --i18n-file "./src/locale/target/messages_$lang.xml" --i18n-format xlf --i18n-locale "$lang" \
--output-path "dist/$lang/" --deploy-url "/client/$lang/"
# Do no duplicate assets
rm -r "./dist/$lang/assets"
done
NODE_ENV=production npm run webpack -- --config webpack/webpack.video-embed.js --mode production

11
scripts/i18n/generate.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
set -eu
cd client
npm run ng -- xi18n --i18n-locale "en-US" --output-path locale/source --out-file messages_en_US.xml
npm run ngx-extractor -- --locale "en-US" -i 'src/**/*.ts' -f xlf -o src/locale/source/messages_en_US.xml
# Zanata does not support inner elements in <source>, so we hack these special elements
# This regex translate the Angular elements to special entities (that we will reconvert on pull)
sed -i 's/<x id=\([^\/]\+\?\)\/>/\&lt;x id=\1\/\&gt;/g' src/locale/source/messages_en_US.xml

7
scripts/i18n/pull-hook.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
set -eu
# Zanata does not support inner elements in <source>, so we hack these special elements
# This regex translate the converted elements to initial Angular elements
sed -i 's/\&lt;x id=\([^\/]\+\?\)\/\&gt;/<x id=\1\/>/g' client/src/locale/target/*

View File

@@ -57,7 +57,7 @@ git commit package.json client/package.json -m "Bumped to version $version"
git tag -s -a "$version" -m "$version"
npm run build
rm "./client/dist/stats.json"
rm "./client/dist/en-US/stats.json"
# Creating the archives
(