From e7e9963e4c5ec68bffc88f0a6f7df23e701057bb Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 24 Aug 2018 12:26:54 -0400 Subject: [PATCH] LP#1775466 Improve locale building Break string export and merge into multiple steps to more easily accomodate other locales down the road. Adds script to stamp the locale-specific index.html file (for fr-CA only now) so users don't have to do it manually. For now, this command is still locale-specific, but we should be able to further generify down the road. Signed-off-by: Bill Erickson --- Open-ILS/src/eg2/README.adoc | 20 ++++++-------------- Open-ILS/src/eg2/package.json | 4 +++- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Open-ILS/src/eg2/README.adoc b/Open-ILS/src/eg2/README.adoc index 3dc9b43890..1e51e6dcc7 100644 --- a/Open-ILS/src/eg2/README.adoc +++ b/Open-ILS/src/eg2/README.adoc @@ -92,25 +92,17 @@ ng lint === OPTIONAL: Building for an alternate locale * Using fr-CA as an example. -* An fr-CA configuration is supplied by default. +* An fr-CA configuration is supplied by default. Additional configs + must be added where needed. * Currently translation builds are only available on --prod build mode. * Uncomment the locale lines in eg_vhost.conf and restart apache. [source,sh] --------------------------------------------------------------------- -npm run build-translations -# Modify some entries in src/locale/messages.fr-CA.xlf to test -ng build --configuration=production-fr-CA --output-path ../../web/eg2/fr-CA --deploy-url /eg2/fr-CA/ --base-href /eg2/fr-CA ---------------------------------------------------------------------- - -* Currently, the IDL import has to be manually modified in - ../../web/eg2/fr-CA/index.html like so: -* TODO: create a script to do this and modify the "lang" attribute - for alt locales. - -[source,html] ---------------------------------------------------------------------- - +npm run export-strings +npm run merge-strings -- fr-CA +# APPLY TRANSLATIONS TO src/locale/messages.fr-CA.xlf +npm run build-fr-CA --------------------------------------------------------------------- === Deploy diff --git a/Open-ILS/src/eg2/package.json b/Open-ILS/src/eg2/package.json index b194c0ff69..d879203129 100644 --- a/Open-ILS/src/eg2/package.json +++ b/Open-ILS/src/eg2/package.json @@ -10,7 +10,9 @@ "lint": "ng lint", "e2e": "ng e2e", "create-mock-idl": "cd src/test_data && perl idl2js.pl", - "build-translations": "ng xi18n --output-path locale && xliffmerge fr-CA" + "export-strings": "ng xi18n --output-path locale", + "merge-strings": "xliffmerge", + "build-fr-CA": "ng build --configuration=production-fr-CA --output-path ../../web/eg2/fr-CA --deploy-url /eg2/fr-CA/ --base-href /eg2/fr-CA; sed -i s/IDL2js\\\"/IDL2js?locale=fr-CA\\\"/g ../../web/eg2/fr-CA/index.html; sed -i s/lang=\\\"en\\\"/lang=\\\"fr\\\"/g ../../web/eg2/fr-CA/index.html" }, "private": true, "dependencies": { -- 2.11.0