Unable to compile czech localization for eg2 in 3.9.0 tarball

Bug #1982887 reported by Václav Jansa
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
High
Unassigned

Bug Description

Due to missing czech localization in EG2 part of staff client is needed to compile cs-CZ localization manualy.

System is based on Ubuntu 20.04 LTS, OpenSRF is installed from git clone, Evergreen ILS is installed from tarball 3.9.0 with developer additions (chapter 3.3 in manual) and chapter 4 for web staff client.

Translation is enabled in Open-ILS/src/eg2/src/environments/environment.prod.ts (added cs-CZ),

During compilation of czech translation

$ cd Open-ILS/src/eg2
$ npm run build-cs-CZ

are reported following errors

# npm run build-cs-CZ

> eg@0.0.0 build-cs-CZ /home/vagojan/install/Evergreen-ILS-3.9.0/Open-ILS/src/eg2
> ng build --configuration=production-cs-CZ --output-path ../../web/eg2/cs-CZ --deploy-url /eg2/cs-CZ/ --base-href /eg2/cs-CZ; sed -i s/IDL2js\"/IDL2js?locale=cs-CZ\"/g ../../web/eg2/cs-CZ/index.html; sed -i s/lang=\"en\"/lang=\"cs\"/g ../../web/eg2/cs-CZ/index.html

Locale data for 'cs-CZ' cannot be found. Using locale data for 'cs'.
WARNING [src/locale/messages.cs-CZ.xtb]: File target locale ('cs') does not match configured locale ('cs-CZ')
✔ Browser application bundle generation complete.
✔ Localized bundle generation complete.
✔ Copying assets complete.
⠋ Generating index html...1 rules skipped due to selector errors:
  .custom-file-input:lang(en)~.custom-file-label -> unmatched pseudo-class :lang
✔ Index html generation complete.

...

Build at: 2022-07-26T20:06:00.649Z - Hash: 9b49334cd9a2367cebfa - Time: 74908ms
sed: can't read ../../web/eg2/cs-CZ/index.html: No such file or directory
sed: can't read ../../web/eg2/cs-CZ/index.html: No such file or directory
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! eg@0.0.0 build-cs-CZ: `ng build --configuration=production-cs-CZ --output-path ../../web/eg2/cs-CZ --deploy-url /eg2/cs-CZ/ --base-href /eg2/cs-CZ; sed -i s/IDL2js\"/IDL2js?locale=cs-CZ\"/g ../../web/eg2/cs-CZ/index.html; sed -i s/lang=\"en\"/lang=\"cs\"/g ../../web/eg2/cs-CZ/index.html`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the eg@0.0.0 build-cs-CZ script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-07-26T20_06_00_752Z-debug.log

in NPM log is

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build-cs-CZ' ]
2 info using npm@6.14.15
3 info using <email address hidden>
4 verbose run-script [ 'prebuild-cs-CZ', 'build-cs-CZ', 'postbuild-cs-CZ' ]
5 info lifecycle eg@0.0.0~prebuild-cs-CZ: eg@0.0.0
6 info lifecycle eg@0.0.0~build-cs-CZ: eg@0.0.0
7 verbose lifecycle eg@0.0.0~build-cs-CZ: unsafe-perm in lifecycle true
8 verbose lifecycle eg@0.0.0~build-cs-CZ: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/vagojan/install/Evergreen-ILS-3.9.0/Open-ILS/src/eg2/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle eg@0.0.0~build-cs-CZ: CWD: /home/vagojan/install/Evergreen-ILS-3.9.0/Open-ILS/src/eg2
10 silly lifecycle eg@0.0.0~build-cs-CZ: Args: [
10 silly lifecycle '-c',
10 silly lifecycle 'ng build --configuration=production-cs-CZ --output-path ../../web/eg2/cs-CZ --deploy-url /eg2/cs-CZ/ --base-href /eg2/cs-CZ; sed -i s/IDL2js\\"/IDL2js?locale=cs-CZ\\"/g ../../web/eg2/cs-CZ/index.html; sed -i s/lang=\\"en\\"/lang=\\"cs\\"/g ../../web/eg2/cs-CZ/index.html'
10 silly lifecycle ]
11 silly lifecycle eg@0.0.0~build-cs-CZ: Returned: code: 2 signal: null
12 info lifecycle eg@0.0.0~build-cs-CZ: Failed to exec build-cs-CZ script
13 verbose stack Error: eg@0.0.0 build-cs-CZ: `ng build --configuration=production-cs-CZ --output-path ../../web/eg2/cs-CZ --deploy-url /eg2/cs-CZ/ --base-href /eg2/cs-CZ; sed -i s/IDL2js\"/IDL2js?locale=cs-CZ\"/g ../../web/eg2/cs-CZ/index.html; sed -i s/lang=\"en\"/lang=\"cs\"/g ../../web/eg2/cs-CZ/index.html`
13 verbose stack Exit status 2
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:400:28)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:400:28)
13 verbose stack at maybeClose (internal/child_process.js:1058:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)
14 verbose pkgid eg@0.0.0
15 verbose cwd /home/vagojan/install/Evergreen-ILS-3.9.0/Open-ILS/src/eg2
16 verbose Linux 5.4.0-122-generic
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build-cs-CZ"
18 verbose node v14.18.1
19 verbose npm v6.14.15
20 error code ELIFECYCLE
21 error errno 2
22 error eg@0.0.0 build-cs-CZ: `ng build --configuration=production-cs-CZ --output-path ../../web/eg2/cs-CZ --deploy-url /eg2/cs-CZ/ --base-href /eg2/cs-CZ; sed -i s/IDL2js\"/IDL2js?locale=cs-CZ\"/g ../../web/eg2/cs-CZ/index.html; sed -i s/lang=\"en\"/lang=\"cs\"/g ../../web/eg2/cs-CZ/index.html`
22 error Exit status 2
23 error Failed at the eg@0.0.0 build-cs-CZ script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

So we are not able to compile and use localized EG2 Angular staff client.

We used the same steps in 3.7 branch without any issue. But with 3.9.0 tarball we are not able to finish it. Directory with localization is not created.

tags: added: i18n
tags: added: install-upgrade
Revision history for this message
Linda Jansova (skolkova-s) wrote :

In other words, steps referenced in the description of another bug - https://bugs.launchpad.net/evergreen/+bug/1967950 - have not led to the desired result, i.e., having the eg2 part of the staff client localized into Czech.

Revision history for this message
Jason Boyer (jboyer) wrote :

We're not using the (current?) i18n features of Angular quite as intended, so even if you run the correct command for today's code: "ng build --configuration production-cs-CZ" the build results are placed in the wrong directory and also breaks the en-US build.

Here's a branch that builds the cs-CZ translations by default, including during the release process: https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/collab/jboyer/lp1982887_eg2_xlate / working/collab/jboyer/lp1982887_eg2_xlate

After applying this branch running ng build --prod will build both en-US and cs-CZ translations. If devs want to avoid this for (minimal) time gains, running "ng build --prod --localize false" will only build en-US.

I think this is worth adding as-is, but one change that may not be desirable is that now the locale selector is always visible, even if only en-US is actually built. That's currently controlled by the list of locales in environment.prod.ts. It's not ideal to have to edit that file to enable or disable the locale selector. Fixing that is for another branch though.

Revision history for this message
Linda Jansova (skolkova-s) wrote :

Thank you very much, Jason! We will give it a try :-).

If it is successful (which is what we hope for), do you have any idea as to which upcoming Evergreen version (the tarball) could officially include this patch/branch?

Revision history for this message
Terran McCanna (tmccanna) wrote :

Jason, should this have a pullrequest?

Revision history for this message
Jason Boyer (jboyer) wrote :

... Yes. :D
There is still some discussion to be had around implementation but that should only result in some addition commits or new bugs.

tags: added: pullrequest
Revision history for this message
Linda Jansova (skolkova-s) wrote :

I can confirm we have tested Jason's code and it works as described. Which release do you suppose this code will be included? Could it be in the 3.9.1 or/and in 3.10 release? We would appreciate it very much as we would like to use either of these versions for our upcoming upgrade :-). Thank you!

Revision history for this message
Terran McCanna (tmccanna) wrote :

(Adding signed off tag on behalf of Linda.)

tags: added: signedoff
Changed in evergreen:
status: New → Confirmed
importance: Undecided → High
milestone: none → 3.9.1
Revision history for this message
Linda Jansova (skolkova-s) wrote :

Thank you very much, Terran!

Galen Charlton (gmc)
Changed in evergreen:
assignee: nobody → Galen Charlton (gmc)
Revision history for this message
Terran McCanna (tmccanna) wrote :

Adding note from Jason Boyer that this will need broader testing before it can be merged because it makes some changes to the way things are built.

tags: removed: signedoff
Revision history for this message
Linda Jansova (skolkova-s) wrote (last edit ):

So maybe this Bug Squashing Week will be a great opportunity for the broader testing needed :-)?

Czech localization in the official tarball is a very important feature for us, especially now that we plan to upgrade our production Evergreen...

Revision history for this message
Galen Charlton (gmc) wrote :

During the release building webinar today, tested and pushed along with a follow-up to only supply en-US out of the box in the Angular build. This is necessary because of the issue where the Angular staff client's navbar's language selector displays all compiled languages regardless of intention or whether they're configured to actually work.

Thanks, Jason and Linda!

Changed in evergreen:
status: Confirmed → Fix Committed
assignee: Galen Charlton (gmc) → nobody
Revision history for this message
Linda Jansova (skolkova-s) wrote :

Thank you very much, Galen!

Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.