From 56709d6d7c8de4d2f6c0659c464b79c7da1e29f1 Mon Sep 17 00:00:00 2001 From: Jason Boyer Date: Wed, 27 Jul 2022 18:07:59 -0400 Subject: [PATCH] LP1982887: Repair translations for eg2 client Previously following the build instructions for the Czech localization placed the results in eg2/cs-CZ/cs-CZ and also broke the en-US build. These changes bring the staff client a little more in line with current Angular localization methods. Note that currently both en-US and cs-CZ are always built. This can be limited to en-US by using "--localize false" on the ng build command line. Until an alternative method to determine the number of available locales is implemented the only way to hide the locale selector is to edit environment.prod.ts. Signed-off-by: Jason Boyer Signed-off-by: Linda Jansova Signed-off-by: Galen Charlton --- Open-ILS/src/eg2/angular.json | 43 ++++++---------------- .../src/eg2/src/environments/environment.prod.ts | 2 +- build/tools/make_release | 2 +- 3 files changed, 14 insertions(+), 33 deletions(-) diff --git a/Open-ILS/src/eg2/angular.json b/Open-ILS/src/eg2/angular.json index 4c1de91969..4ca6e08906 100644 --- a/Open-ILS/src/eg2/angular.json +++ b/Open-ILS/src/eg2/angular.json @@ -7,15 +7,24 @@ "root": "", "sourceRoot": "src", "projectType": "application", + "i18n": { + "sourceLocale": "en-US", + "locales": { + "cs-CZ": { + "translation": "src/locale/messages.cs-CZ.xtb" + } + } + }, "architect": { "build": { "builder": "@angular-devkit/build-angular:browser", "options": { - "baseHref": "/eg2/en-US", - "deployUrl": "/eg2/en-US/", - "outputPath": "../../web/eg2/en-US", + "baseHref": "/eg2/", + "deployUrl": "/eg2/", + "outputPath": "../../web/eg2/", "index": "src/index.html", "main": "src/main.ts", + "localize": true, "tsConfig": "src/tsconfig.app.json", "polyfills": "src/polyfills.ts", "assets": [ @@ -57,26 +66,6 @@ "with": "src/environments/environment.prod.ts" } ] - }, - "production-cs-CZ": { - "optimization": true, - "outputHashing": "all", - "sourceMap": false, - "namedChunks": false, - "aot": true, - "extractLicenses": true, - "vendorChunk": false, - "buildOptimizer": true, - "i18nMissingTranslation": "ignore", - "fileReplacements": [ - { - "replace": "src/environments/environment.ts", - "with": "src/environments/environment.prod.ts" - } - ], - "localize": [ - "cs-CZ" - ] } }, "defaultConfiguration": "" @@ -124,14 +113,6 @@ ] } } - }, - "i18n": { - "locales": { - "cs-CZ": { - "translation": "src/locale/messages.cs-CZ.xtb", - "baseHref": "" - } - } } }, "eg-e2e": { diff --git a/Open-ILS/src/eg2/src/environments/environment.prod.ts b/Open-ILS/src/eg2/src/environments/environment.prod.ts index d7953f9f8a..aa207e6a9e 100644 --- a/Open-ILS/src/eg2/src/environments/environment.prod.ts +++ b/Open-ILS/src/eg2/src/environments/environment.prod.ts @@ -2,5 +2,5 @@ export const environment = { production: true, // TODO: a way to pass these in at build time. // locales: ['en-US', 'fr-CA', 'cs-CZ'] - locales: ['en-US'] + locales: ['en-US', 'cs-CZ'] }; diff --git a/build/tools/make_release b/build/tools/make_release index 19d1cf95dd..15402386d8 100755 --- a/build/tools/make_release +++ b/build/tools/make_release @@ -355,7 +355,7 @@ if [ "$BUILD_BROWSER_CLIENT" == "YES" ]; then echo "Building Angular browser staff client" cd src/eg2 npm install # fetch build dependencies - ng build --prod + ng build --configuration production --localize true # npm cache is big and unnecessary in the final build. remove it. rm -rf node_modules cd ../../../../ # release dir -- 2.11.0