Bug 37814 - Wrong use of __() in .tt files
Summary: Wrong use of __() in .tt files
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 28130 35511
Blocks:
  Show dependency treegraph
 
Reported: 2024-09-03 08:00 UTC by Jonathan Druart
Modified: 2024-11-15 21:23 UTC (History)
3 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:
24.11.00,24.05.06
Circulation function:


Attachments
Bug 37814: Fix incorrect use of __() in .tt files (4.15 KB, patch)
2024-09-03 12:32 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 37814: Fix incorrect use of __() in .tt files (4.22 KB, patch)
2024-09-03 13:41 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2024-09-03 08:00:42 UTC
__() does not work in .tt files (only .js files)
_() must be used instead

The 4 occurrences returned here are wrong.

% git grep '__(' **/*.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/alert-subscriptions.tt:                return confirmDelete(__("Are you sure you want to unsubscribe %s from email alerts for %s?").format(patron, title));
koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt:                node.addClass("collapsed").removeClass("expanded").attr("title", __("Click to expand this section") );
koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt:                node.addClass("expanded").removeClass("collapsed").attr("title", __("Click to collapse this section") );
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-alert-subscriptions.tt:            return confirmDelete(__("Are you sure you want to unsubscribe %s from email alerts for %s?").format(patron, title));
Comment 1 Owen Leonard 2024-09-03 12:32:25 UTC
Created attachment 170981 [details] [review]
Bug 37814: Fix incorrect use of __() in .tt files

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

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

  > gulp po:update --lang fr-FR

- Open the corresponding .po file for the affected  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/modules/members/alert-subscriptions.tt:
    "Are you sure you want to unsubscribe %s from email alerts for %s?"
  - koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
    "Click to expand this section"

- Check fr-FR-opac-bootstrap.po for this line:
  - koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-alert-subscriptions.tt:
    "Are you sure you want to unsubscribe %s from email alerts for %s?"

Sponsored-by: Athens County Public Libraries
Comment 2 Jonathan Druart 2024-09-03 13:41:24 UTC
Created attachment 170989 [details] [review]
Bug 37814: Fix incorrect use of __() in .tt files

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

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

  > gulp po:update --lang fr-FR

- Open the corresponding .po file for the affected  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/modules/members/alert-subscriptions.tt:
    "Are you sure you want to unsubscribe %s from email alerts for %s?"
  - koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
    "Click to expand this section"

- Check fr-FR-opac-bootstrap.po for this line:
  - koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-alert-subscriptions.tt:
    "Are you sure you want to unsubscribe %s from email alerts for %s?"

Sponsored-by: Athens County Public Libraries

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 3 Jonathan Druart 2024-09-03 13:45:30 UTC
Trivial, skipping QA.
Comment 4 Katrin Fischer 2024-09-13 09:29:20 UTC
Thanks for these!
Comment 5 Katrin Fischer 2024-09-13 10:08:01 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 6 Lucas Gass (lukeg) 2024-11-15 21:23:57 UTC
Backported to 24.05.x for upcoming 24.05.06