Bug 34038

Summary: Fix incorrect use of __() in .tt and .inc files
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: Pushed to oldstable --- QA Contact: Katrin Fischer <katrin.fischer>
Severity: normal    
Priority: P5 - low CC: caroline.cyr-la-rose, dcook, fridolin.somers
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.04,22.11.10
Bug Depends on: 21156    
Bug Blocks: 34801    
Attachments: Bug 34038: Fix incorrect use of __() in .tt and .inc files
Bug 34038: Fix incorrect use of __() in .tt and .inc files
Bug 34038: Fix incorrect use of __() in .tt and .inc files

Description Owen Leonard 2023-06-16 14:02:09 UTC
We have several instances of translatable strings in templates and include files being wrapped in the double-underscore function which should only be used in .js files.
Comment 1 Owen Leonard 2023-06-16 14:50:42 UTC
Created attachment 152421 [details] [review]
Bug 34038: Fix incorrect use of __() in .tt and .inc files

This patch corrects instances of the double-underscore function being
used in .tt and .inc files where the single-underscore function should
be used instead.

To test, apply the patch and update a translation, e.g. fr-FR:

  > cd misc/translator
  > perl translate update fr-FR

- Open the corresponding .po file for JavaScript strings, in this case
  misc/translator/po/fr-FR-staff-prog.po
- Confirm that the strings are now in the .po file for translation. You
  should find these lines:

- koha-tmpl/intranet-tmpl/prog/en/includes/js-biblio-format.inc: "No
  title."
- koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt:
  "Check in and add to bundle"
  "Ignore holds and add to bundle"
- koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step1.tt:
  "Please enter only a barcode, or only a biblionumber."
- koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/batch_add_items.tt:
  "Please enter only barcodes, or only biblionumbers."
- koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt:
  "Please specify a content for 'Default'"

- Check fr-FR-opac-bootstrap.po for these lines:

- koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc:
  "Please enter a valid date (should match %s)."
- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt:
  "No item was selected"
- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt,
  koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt,
  koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt:
  "No item was selected"
Comment 2 Caroline Cyr La Rose 2023-08-08 20:07:50 UTC
Hi Owen, I tried this and I still don't see the strings in the po file. I applied the patch, then ./misc/translator/translate update fr-CA then checked in fr-CA-staff-prog.po for the strings (specifically "Check in and add to bundle" since it's unique) and they are not there. I'm probably missing a step?
Comment 3 Owen Leonard 2023-08-21 13:37:14 UTC
Caroline could you try again? It seems to work for me, and it sounds like you're testing correctly.
Comment 4 David Cook 2023-09-06 00:41:07 UTC
Created attachment 155246 [details] [review]
Bug 34038: Fix incorrect use of __() in .tt and .inc files

This patch corrects instances of the double-underscore function being
used in .tt and .inc files where the single-underscore function should
be used instead.

To test, apply the patch and update a translation, e.g. fr-FR:

  > cd misc/translator
  > perl translate update fr-FR

- Open the corresponding .po file for JavaScript strings, in this case
  misc/translator/po/fr-FR-staff-prog.po
- Confirm that the strings are now in the .po file for translation. You
  should find these lines:

- koha-tmpl/intranet-tmpl/prog/en/includes/js-biblio-format.inc: "No
  title."
- koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt:
  "Check in and add to bundle"
  "Ignore holds and add to bundle"
- koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step1.tt:
  "Please enter only a barcode, or only a biblionumber."
- koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/batch_add_items.tt:
  "Please enter only barcodes, or only biblionumbers."
- koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt:
  "Please specify a content for 'Default'"

- Check fr-FR-opac-bootstrap.po for these lines:

- koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc:
  "Please enter a valid date (should match %s)."
- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt:
  "No item was selected"
- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt,
  koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt,
  koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt:
  "No item was selected"

Signed-off-by: David Cook <dcook@prosentient.com.au>
Comment 5 David Cook 2023-09-06 00:41:35 UTC
No problemo on this end
Comment 6 David Cook 2023-09-06 00:42:34 UTC
Btw also passed QA tools
Comment 7 Katrin Fischer 2023-09-08 11:55:55 UTC
Created attachment 155408 [details] [review]
Bug 34038: Fix incorrect use of __() in .tt and .inc files

This patch corrects instances of the double-underscore function being
used in .tt and .inc files where the single-underscore function should
be used instead.

To test, apply the patch and update a translation, e.g. fr-FR:

  > cd misc/translator
  > perl translate update fr-FR

- Open the corresponding .po file for JavaScript strings, in this case
  misc/translator/po/fr-FR-staff-prog.po
- Confirm that the strings are now in the .po file for translation. You
  should find these lines:

- koha-tmpl/intranet-tmpl/prog/en/includes/js-biblio-format.inc: "No
  title."
- koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt:
  "Check in and add to bundle"
  "Ignore holds and add to bundle"
- koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step1.tt:
  "Please enter only a barcode, or only a biblionumber."
- koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/batch_add_items.tt:
  "Please enter only barcodes, or only biblionumbers."
- koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt:
  "Please specify a content for 'Default'"

- Check fr-FR-opac-bootstrap.po for these lines:

- koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc:
  "Please enter a valid date (should match %s)."
- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt:
  "No item was selected"
- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt,
  koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt,
  koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt:
  "No item was selected"

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Comment 8 Tomás Cohen Arazi 2023-09-08 14:54:07 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 9 Fridolin Somers 2023-09-08 19:38:08 UTC
Added to https://gitlab.com/koha-community/qa-test-tools/-/issues/55
Comment 10 Fridolin Somers 2023-09-08 19:38:33 UTC
Pushed to 23.05.x for 23.05.04
Comment 11 Matt Blenkinsop 2023-09-15 10:08:44 UTC
Nice work everyone!

Pushed to oldstable for 22.11.x