From f07d6385b4b46c3254898292a8a53ed415b8d49b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 6 Jun 2018 14:33:21 +0200 Subject: Rename messages locale to angular --- scripts/i18n/create-custom-files.ts | 23 ++++++++++++++--------- scripts/i18n/generate.sh | 7 +++---- scripts/i18n/pull-hook.sh | 1 - 3 files changed, 17 insertions(+), 14 deletions(-) (limited to 'scripts') diff --git a/scripts/i18n/create-custom-files.ts b/scripts/i18n/create-custom-files.ts index 3895b3b9d..d8a87f291 100755 --- a/scripts/i18n/create-custom-files.ts +++ b/scripts/i18n/create-custom-files.ts @@ -30,20 +30,25 @@ for (const sourceObject of [ videojs, playerKeys ]) { Object.keys(sourceObject).forEach(k => obj.resources.namespace1[ k ] = { source: sourceObject[ k ] }) } -jsToXliff12(obj, (err, res) => { +saveToXliffFile(playerTarget, obj, err => { if (err) { console.error(err) process.exit(-1) } - writeFile(playerTarget, res, err => { - if (err) { - console.error(err) - process.exit(-1) - } - - process.exit(0) - }) + process.exit(0) }) // Then, the server strings + +function saveToXliffFile (targetPath: string, obj: any, cb: Function) { + jsToXliff12(obj, (err, res) => { + if (err) return cb(err) + + writeFile(playerTarget, res, err => { + if (err) return cb(err) + + return cb(null) + }) + }) +} diff --git a/scripts/i18n/generate.sh b/scripts/i18n/generate.sh index 0a5b6dee1..f93d6cc03 100755 --- a/scripts/i18n/generate.sh +++ b/scripts/i18n/generate.sh @@ -3,13 +3,12 @@ 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 +npm run ng -- xi18n --i18n-locale "en-US" --output-path locale/source --out-file angular_en_US.xml +npm run ngx-extractor -- --locale "en-US" -i 'src/**/*.ts' -f xlf -o src/locale/source/angular_en_US.xml # Zanata does not support inner elements in , 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=\1\/\>/g' src/locale/source/messages_en_US.xml -perl -pi -e 's||<x id=\1/>|g' src/locale/source/messages_en_US.xml +perl -pi -e 's||<x id=\1/>|g' src/locale/source/angular_en_US.xml # Add our strings too cd ../ diff --git a/scripts/i18n/pull-hook.sh b/scripts/i18n/pull-hook.sh index dec426b88..3d57040cc 100755 --- a/scripts/i18n/pull-hook.sh +++ b/scripts/i18n/pull-hook.sh @@ -4,7 +4,6 @@ set -eu # Zanata does not support inner elements in , so we hack these special elements # This regex translate the converted elements to initial Angular elements -#sed -i 's/\<x id=\(.\+\?\)\/\>//g' client/src/locale/target/* for i in 1 2 3; do perl -pi -e 's|<x id=(.+?)/>([^"])|\2|g' client/src/locale/target/*.xml -- cgit v1.2.3