Bug 24725 - xgettext does not support (yet) ES template literals
Summary: xgettext does not support (yet) ES template literals
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact:
URL:
Keywords:
Depends on: 14697 21156 24727
Blocks:
  Show dependency treegraph
 
Reported: 2020-02-25 13:14 UTC by Jonathan Druart
Modified: 2023-06-19 01:57 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00
Circulation function:


Attachments
Bug 24725: Remove ES template literals in checkouts.js (6.14 KB, patch)
2020-02-25 13:54 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 24725: Remove ES template literals in checkouts.js (13.37 KB, patch)
2020-02-25 14:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 24725: Remove ES template literals in checkouts.js (13.43 KB, patch)
2020-02-26 14:17 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 24725: Remove ES template literals in checkouts.js (13.49 KB, patch)
2020-02-29 11:35 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 24725: (QA follow-up) Add missing spaces between elements on claims tab (1.56 KB, patch)
2020-02-29 11:35 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2020-02-25 13:14:24 UTC
From Julian on bug 24661 comment 6:
"""
It looks like xgettext does not like ES6 template literals.

https://savannah.gnu.org/bugs/?50920

From what I understand, support for template literals was added in gettext 0.20 (still not packaged in debian) but is still buggy in latest released version 0.20.1 and a fix is present in master.
"""

We should not use backticks ` in .js file, it breaks xgettext.

To replicate:
kohadev-koha@e1f3025cca60:/kohadevbox/koha/misc/translator$ perl translate update es-ES
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:569: warning: unterminated string
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:858: warning: unterminated string
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:904: warning: unterminated string
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:911: warning: unterminated string
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:1095: warning: RegExp literal terminated too early
/usr/bin/msgmerge: error while opening "/kohadevbox/koha/misc/translator/po/es-ES-messages-js.po" for reading: No such file or directory

(last error 'No such file or directory' is not related to this).
Comment 1 Jonathan Druart 2020-02-25 13:54:24 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2020-02-25 14:02:04 UTC Comment hidden (obsolete)
Comment 3 Martin Renvoize (ashimema) 2020-02-26 14:17:47 UTC Comment hidden (obsolete)
Comment 4 Martin Renvoize (ashimema) 2020-02-26 14:18:05 UTC
Nothing obviously broken in the relevant table.. Signing off.
Comment 5 Katrin Fischer 2020-02-29 11:35:11 UTC
Created attachment 99814 [details] [review]
Bug 24725: Remove ES template literals in checkouts.js

From Julian on bug 24661 comment 6:
"""
It looks like xgettext does not like ES6 template literals.

https://savannah.gnu.org/bugs/?50920

From what I understand, support for template literals was added in gettext 0.20 (still not packaged in debian) but is still buggy in latest released version 0.20.1 and a fix is present in master.
"""

We should not use backticks ` in .js file, it breaks xgettext.

To replicate:
kohadev-koha@e1f3025cca60:/kohadevbox/koha/misc/translator$ perl translate update es-ES
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:569: warning: unterminated string
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:858: warning: unterminated string
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:904: warning: unterminated string
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:911: warning: unterminated string
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:1095: warning: RegExp literal terminated too early
/usr/bin/msgmerge: error while opening "/kohadevbox/koha/misc/translator/po/es-ES-messages-js.po" for reading: No such file or directory

(last error 'No such file or directory' is not related to this).

Test plan:
Make sure nothing is broken on the claims table
Confirm that the errors do not longer appear on `perl translate update LANG`

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Katrin Fischer 2020-02-29 11:35:15 UTC
Created attachment 99815 [details] [review]
Bug 24725: (QA follow-up) Add missing spaces between elements on claims tab

There was a missing space between the title and the barcode.
Also added a space between title and author.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 7 Katrin Fischer 2020-02-29 11:35:43 UTC
Should we have a QA script check/coding guidelines for this?
Comment 8 Martin Renvoize (ashimema) 2020-03-02 09:47:33 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 9 Jonathan Druart 2020-03-02 11:40:39 UTC
(In reply to Katrin Fischer from comment #7)
> Should we have a QA script check/coding guidelines for this?

See https://gitlab.com/koha-community/qa-test-tools/issues/26 for the QA check.
Comment 10 Lucas Gass (lukeg) 2020-03-18 16:42:10 UTC
missing 19.05.x dependencies, no backport
Comment 11 Joy Nelson 2020-04-01 20:38:26 UTC
does not apply to 19.11.x branch.  please rebase if needed.
Comment 12 David Cook 2023-06-16 01:07:17 UTC
Hopefully it gets support for template literals in the near future. Template literals are so useful...
Comment 13 Jonathan Druart 2023-06-16 06:15:30 UTC
(In reply to David Cook from comment #12)
> Hopefully it gets support for template literals in the near future. Template
> literals are so useful...

The bug is fixed it's no longer a limitation. We should remove the QA check.
Comment 14 Jonathan Druart 2023-06-16 06:46:39 UTC
(In reply to Jonathan Druart from comment #13)
> (In reply to David Cook from comment #12)
> > Hopefully it gets support for template literals in the near future. Template
> > literals are so useful...
> 
> The bug is fixed it's no longer a limitation. We should remove the QA check.

See
https://gitlab.com/koha-community/qa-test-tools/-/issues/67
https://gitlab.com/koha-community/qa-test-tools/-/merge_requests/54
Comment 15 David Cook 2023-06-19 01:57:03 UTC
Great news!