Bug 38450 - Missing translation string in catalogue_detail.inc
Summary: Missing translation string in catalogue_detail.inc
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: Jonathan Druart
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-14 16:58 UTC by Andreas Jonsson
Modified: 2025-06-02 21:32 UTC (History)
6 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes some missing strings in the po files used for translation. Strings in this format were being included for translation: _("This %s is picked").format(foo) However, strings using this format were not: _("This %s is NOT picked".format(bar))
Version(s) released in:
25.05.00,24.11.02
Circulation function:


Attachments
Bug 38450: Fix some translation pickups (5.92 KB, patch)
2024-11-18 10:04 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 38450: Fix some translation pickups (5.96 KB, patch)
2024-11-27 21:13 UTC, David Nind
Details | Diff | Splinter Review
Bug 38450: Fix some translation pickups (6.06 KB, patch)
2024-12-06 09:51 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Jonsson 2024-11-14 16:58:31 UTC
The string "Waiting at %s, %s since %s." in koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc is missing in Weblate. Is there a problem with the string extraction?
Comment 1 Katrin Fischer 2024-11-14 17:00:14 UTC
We found out today that the strings hadn't been synced properly for a little while. Please check again tomorrow!
Comment 2 Jonathan Druart 2024-11-14 18:34:01 UTC
Indeed, please check again tomorrow.
Comment 3 Jonathan Druart 2024-11-18 09:55:13 UTC
This is valid.
Comment 4 Jonathan Druart 2024-11-18 10:04:49 UTC
Created attachment 174672 [details] [review]
Bug 38450: Fix some translation pickups

_("This %s is picked").format(foo)
_("This %s is NOT picked".format(bar))

Both constructs are valid, but our translation script does not pick the
second one.

I found very few occurrences (using `git grep '.".format('`) that are
displayed on the UI. I don't have the time right now to deep dive into
the translation script to fix this problem, easier to adjust the
occurrences.

How to prevent that in the future however? We could raise a warning from
the QA script.

Test plan:
Do not apply this patch
Generate the strings (`gulp po:update --lang LANG`)
cd misc/translator/po && git commit -a -m"wip"
Apply this patch, regenerate the strings
cd misc/translator/po && git diff

Notice the changes, you should see new translations added to the .po
files.
Ideally translate them, install the templates and confirm that the new
strings are translated on the UI.
Comment 5 Jonathan Druart 2024-11-18 10:07:47 UTC
(In reply to Jonathan Druart from comment #4)
> How to prevent that in the future however? We could raise a warning from
> the QA script.

Opened https://gitlab.com/koha-community/qa-test-tools/-/issues/89
Comment 6 David Nind 2024-11-27 21:13:08 UTC
Created attachment 175013 [details] [review]
Bug 38450: Fix some translation pickups

_("This %s is picked").format(foo)
_("This %s is NOT picked".format(bar))

Both constructs are valid, but our translation script does not pick the
second one.

I found very few occurrences (using `git grep '.".format('`) that are
displayed on the UI. I don't have the time right now to deep dive into
the translation script to fix this problem, easier to adjust the
occurrences.

How to prevent that in the future however? We could raise a warning from
the QA script.

Test plan:
Do not apply this patch
Generate the strings (`gulp po:update --lang LANG`)
cd misc/translator/po && git commit -a -m"wip"
Apply this patch, regenerate the strings
cd misc/translator/po && git diff

Notice the changes, you should see new translations added to the .po
files.
Ideally translate them, install the templates and confirm that the new
strings are translated on the UI.

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 Marcel de Rooy 2024-12-06 09:51:34 UTC
Created attachment 175256 [details] [review]
Bug 38450: Fix some translation pickups

_("This %s is picked").format(foo)
_("This %s is NOT picked".format(bar))

Both constructs are valid, but our translation script does not pick the
second one.

I found very few occurrences (using `git grep '.".format('`) that are
displayed on the UI. I don't have the time right now to deep dive into
the translation script to fix this problem, easier to adjust the
occurrences.

How to prevent that in the future however? We could raise a warning from
the QA script.

Test plan:
Do not apply this patch
Generate the strings (`gulp po:update --lang LANG`)
cd misc/translator/po && git commit -a -m"wip"
Apply this patch, regenerate the strings
cd misc/translator/po && git diff

Notice the changes, you should see new translations added to the .po
files.
Ideally translate them, install the templates and confirm that the new
strings are translated on the UI.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 8 Katrin Fischer 2024-12-23 08:38:14 UTC
Pushed for 25.05!

Well done everyone, thank you!
Comment 9 Paul Derscheid 2025-02-03 19:09:16 UTC
Nice work everyone!

Pushed to 24.11.x for 24.11.01
Comment 10 Alex Buckley 2025-03-19 20:56:44 UTC
Hi Jonathan,

We are testing this patchset for backport to 24.05.x

I would like to check I am testing it correctly please:

===

BEFORE APPLYING PATCH ON 24.05.X

kohadev-koha@kohadevbox:koha((4470b0f18cc...))$ gulp po:update --lang en-NZ
[20:46:41] Using gulpfile /kohadevbox/koha/gulpfile.js
[20:46:41] Starting 'po:update'...
[20:46:41] Starting 'po_update_marc_marc21'...
[20:46:41] Starting 'po_update_marc_unimarc'...
[20:46:41] Starting 'po_update_staff'...
[20:46:41] Starting 'po_update_opac'...
[20:46:41] Starting 'po_update_pref'...
[20:46:41] Starting 'po_update_messages'...
[20:46:41] Starting 'po_update_messages_js'...
[20:46:41] Starting 'po_update_installer'...
[20:46:41] Starting 'po_update_installer_marc21'...
[20:46:41] Starting 'po_update_installer_unimarc'...
[20:46:41] Finished 'po_update_pref' after 452 ms
[20:46:42] Finished 'po_update_installer_unimarc' after 511 ms
[20:46:42] Finished 'po_update_installer' after 513 ms
[20:46:42] Finished 'po_update_installer_marc21' after 573 ms
[20:46:42] Finished 'po_update_messages_js' after 719 ms
[20:46:42] Finished 'po_update_marc_unimarc' after 1.03 s
[20:46:42] Finished 'po_update_opac' after 1.04 s
[20:46:42] Finished 'po_update_marc_marc21' after 1.42 s
[20:46:43] Finished 'po_update_messages' after 2.07 s
[20:46:45] Finished 'po_update_staff' after 3.51 s
[20:46:45] Finished 'po:update' after 3.51 s
kohadev-koha@kohadevbox:koha((4470b0f18cc...))$ cd misc/translator/po && git commit -a -m"wip"
Success, pre-commit checks passed
HEAD detached at upstream/24.05.x
Untracked files:
  (use "git add <file>..." to include in what will be committed)
	../Koha-installer-MARC21.pot
	../Koha-installer-UNIMARC.pot
	../Koha-installer.pot
	../Koha-marc-MARC21.pot
	../Koha-marc-UNIMARC.pot
	../Koha-messages-js.pot
	../Koha-messages.pot
	../Koha-opac-bootstrap.pot
	../Koha-pref.pot
	../Koha-staff-prog.pot

nothing added to commit but untracked files present (use "git add" to track)
kohadev-koha@kohadevbox:po((4470b0f18cc...))$ 


---

AFTER APPLYING PATCH ON 24.05.x

kohadev-koha@kohadevbox:koha((4470b0f18cc...))$ git cherry-pick 07bb1730fc78e8148caff0ebcf0cba22ba0a4f9f
Auto-merging koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc
Auto-merging koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc
Auto-merging koha-tmpl/intranet-tmpl/prog/js/checkouts.js
Auto-merging koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js
[detached HEAD 46aa2dd71e7] Bug 38450: Fix some translation pickups
 Author: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
 Date: Mon Nov 18 10:57:22 2024 +0100
 4 files changed, 6 insertions(+), 6 deletions(-)
kohadev-koha@kohadevbox:koha((46aa2dd71e7...))$ 
kohadev-koha@kohadevbox:koha((46aa2dd71e7...))$ 
kohadev-koha@kohadevbox:koha((46aa2dd71e7...))$ 
kohadev-koha@kohadevbox:koha((46aa2dd71e7...))$ gulp po:update --lang en-NZ
[20:37:52] Using gulpfile /kohadevbox/koha/gulpfile.js
[20:37:52] Starting 'po:update'...
[20:37:52] Starting 'po_update_marc_marc21'...
[20:37:52] Starting 'po_update_marc_unimarc'...
[20:37:52] Starting 'po_update_staff'...
[20:37:52] Starting 'po_update_opac'...
[20:37:52] Starting 'po_update_pref'...
[20:37:52] Starting 'po_update_messages'...
[20:37:52] Starting 'po_update_messages_js'...
[20:37:52] Starting 'po_update_installer'...
[20:37:52] Starting 'po_update_installer_marc21'...
[20:37:52] Starting 'po_update_installer_unimarc'...
[20:37:52] Finished 'po_update_installer_unimarc' after 508 ms
[20:37:52] Finished 'po_update_installer' after 509 ms
[20:37:52] Finished 'po_update_pref' after 654 ms
[20:37:52] Finished 'po_update_messages_js' after 660 ms
[20:37:52] Finished 'po_update_installer_marc21' after 690 ms
[20:37:53] Finished 'po_update_marc_unimarc' after 999 ms
[20:37:53] Finished 'po_update_opac' after 1.02 s
[20:37:53] Finished 'po_update_marc_marc21' after 1.41 s
[20:37:54] Finished 'po_update_messages' after 1.97 s
[20:37:55] Finished 'po_update_staff' after 3.39 s
[20:37:55] Finished 'po:update' after 3.39 s
kohadev-koha@kohadevbox:koha((46aa2dd71e7...))$ cd misc/translator/po && git diff
kohadev-koha@kohadevbox:po((46aa2dd71e7...))$ 


====

Notice there are no new translations added to the .po files after regenerating the strings.

Am I testing this incorrectly?
Comment 11 Jonathan Druart 2025-03-20 13:50:45 UTC
(In reply to Alex Buckley from comment #10)
> Hi Jonathan,
> 
> We are testing this patchset for backport to 24.05.x
> 
> I would like to check I am testing it correctly please:
> [skip]
> 
> Am I testing this incorrectly?

I think I've followed the exact same steps. However I have a diff

+#. For the first occurrence,
+#. SCRIPT
+#: koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc:78
+#: koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc:75
+#, fuzzy, c-format
+msgid "Waiting at %s since %s."
+msgstr "Billing date: %s From %s To %s %s All since %s %s "
 
+#. SCRIPT
+#: koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc:78
+#, fuzzy
+msgid "Waiting at %s, %s since %s."
+msgstr "Billing date: %s From %s To %s %s All since %s %s "


+#. SCRIPT
+#: koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc:1
+#, fuzzy
+msgid "A patron from %s"
+msgstr "User library"

Which are the expected changes.
Comment 12 Alex Buckley 2025-03-21 04:13:30 UTC
(In reply to Jonathan Druart from comment #11)
> (In reply to Alex Buckley from comment #10)
> > Hi Jonathan,
> > 
> > We are testing this patchset for backport to 24.05.x
> > 
> > I would like to check I am testing it correctly please:
> > [skip]
> > 
> > Am I testing this incorrectly?
> 
> I think I've followed the exact same steps. However I have a diff
> 
> +#. For the first occurrence,
> +#. SCRIPT
> +#:
> koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/
> catalogue_detail.inc:78
> +#: koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc:75
> +#, fuzzy, c-format
> +msgid "Waiting at %s since %s."
> +msgstr "Billing date: %s From %s To %s %s All since %s %s "
>  
> +#. SCRIPT
> +#:
> koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/
> catalogue_detail.inc:78
> +#, fuzzy
> +msgid "Waiting at %s, %s since %s."
> +msgstr "Billing date: %s From %s To %s %s All since %s %s "
> 
> 
> +#. SCRIPT
> +#: koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc:1
> +#, fuzzy
> +msgid "A patron from %s"
> +msgstr "User library"
> 
> Which are the expected changes.


Thank you for testing Jonathan.

We will look into getting this backported next month - to 24.05.09, now we are so close to the March release.
Comment 13 Wainui Witika-Park 2025-04-15 08:45:00 UTC
(In reply to Alex Buckley from comment #12)
> (In reply to Jonathan Druart from comment #11)
> > (In reply to Alex Buckley from comment #10)
> > > Hi Jonathan,
> > > 
> > > We are testing this patchset for backport to 24.05.x
> > > 
> > > I would like to check I am testing it correctly please:
> > > [skip]
> > > 
> > > Am I testing this incorrectly?
> > 
> > I think I've followed the exact same steps. However I have a diff
> > 
> > +#. For the first occurrence,
> > +#. SCRIPT
> > +#:
> > koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/
> > catalogue_detail.inc:78
> > +#: koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc:75
> > +#, fuzzy, c-format
> > +msgid "Waiting at %s since %s."
> > +msgstr "Billing date: %s From %s To %s %s All since %s %s "
> >  
> > +#. SCRIPT
> > +#:
> > koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/
> > catalogue_detail.inc:78
> > +#, fuzzy
> > +msgid "Waiting at %s, %s since %s."
> > +msgstr "Billing date: %s From %s To %s %s All since %s %s "
> > 
> > 
> > +#. SCRIPT
> > +#: koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc:1
> > +#, fuzzy
> > +msgid "A patron from %s"
> > +msgstr "User library"
> > 
> > Which are the expected changes.
> 
> 
> Thank you for testing Jonathan.
> 
> We will look into getting this backported next month - to 24.05.09, now we
> are so close to the March release.

I'm taking over from Alex this month for 24.05

This is what I am getting - 

Before applying patch:

$ gulp po:update --lang en-NZ
[08:33:17] Using gulpfile /kohadevbox/koha/gulpfile.js
[08:33:17] Starting 'po:update'...
[08:33:17] Starting 'po_update_marc_marc21'...
[08:33:17] Starting 'po_update_marc_unimarc'...
[08:33:17] Starting 'po_update_staff'...
[08:33:17] Starting 'po_update_opac'...
[08:33:17] Starting 'po_update_pref'...
[08:33:17] Starting 'po_update_messages'...
[08:33:17] Starting 'po_update_messages_js'...
[08:33:17] Starting 'po_update_installer'...
[08:33:17] Starting 'po_update_installer_marc21'...
[08:33:17] Starting 'po_update_installer_unimarc'...
[08:33:20] Finished 'po_update_installer_unimarc' after 3.03 s
[08:33:20] Finished 'po_update_installer' after 3.14 s
[08:33:20] Finished 'po_update_installer_marc21' after 3.22 s
[08:33:20] Finished 'po_update_pref' after 3.5 s
[08:33:20] Finished 'po_update_messages_js' after 3.65 s
[08:33:21] Finished 'po_update_marc_unimarc' after 4.41 s
[08:33:21] Finished 'po_update_opac' after 4.53 s
[08:33:22] Finished 'po_update_marc_marc21' after 5.29 s
[08:33:23] Finished 'po_update_messages' after 6.45 s
[08:33:27] Finished 'po_update_staff' after 11 s
[08:33:27] Finished 'po:update' after 11 s
$ cd misc/translator/po && git commit -a -m"wip"
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
[main 98e5f94049] wip
 14 files changed, 50077 insertions(+), 49564 deletions(-)
 delete mode 100644 debian/changelog
 delete mode 100644 debian/compat
 delete mode 100644 debian/control
 delete mode 100644 debian/koha-l10n.install
 delete mode 100755 debian/rules

After applying patch:

kohadev-koha@kohadevbox:koha((9845b28bc70...))$ gulp po:update --lang en-NZ
[08:37:32] Using gulpfile /kohadevbox/koha/gulpfile.js
[08:37:32] Starting 'po:update'...
[08:37:32] Starting 'po_update_marc_marc21'...
[08:37:32] Starting 'po_update_marc_unimarc'...
[08:37:32] Starting 'po_update_staff'...
[08:37:32] Starting 'po_update_opac'...
[08:37:32] Starting 'po_update_pref'...
[08:37:32] Starting 'po_update_messages'...
[08:37:32] Starting 'po_update_messages_js'...
[08:37:32] Starting 'po_update_installer'...
[08:37:32] Starting 'po_update_installer_marc21'...
[08:37:32] Starting 'po_update_installer_unimarc'...
[08:37:35] Finished 'po_update_installer_unimarc' after 2.92 s
[08:37:35] Finished 'po_update_installer' after 2.97 s
[08:37:35] Finished 'po_update_installer_marc21' after 3.1 s
[08:37:35] Finished 'po_update_pref' after 3.13 s
[08:37:36] Finished 'po_update_messages_js' after 3.48 s
[08:37:36] Finished 'po_update_marc_unimarc' after 4.1 s
[08:37:36] Finished 'po_update_opac' after 4.12 s
[08:37:37] Finished 'po_update_marc_marc21' after 4.84 s
[08:37:38] Finished 'po_update_messages' after 5.89 s
[08:37:40] Finished 'po_update_staff' after 7.89 s
[08:37:40] Finished 'po:update' after 7.89 s
kohadev-koha@kohadevbox:koha((9845b28bc70...))$ cd misc/translator/po && git diff
diff --git a/en-NZ-staff-prog.po b/en-NZ-staff-prog.po
index afdf78a012..7d04445a4f 100644
--- a/en-NZ-staff-prog.po
+++ b/en-NZ-staff-prog.po
@@ -3,7 +3,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Koha 24.12.00.024\n"
 "Report-Msgid-Bugs-To: koha-translate@lists.koha-community.org\n"
-"POT-Creation-Date: 2025-04-15 08:33+0000\n"
+"POT-Creation-Date: 2025-04-15 08:37+0000\n"
 "PO-Revision-Date: 2024-10-08 03:00+0000\n"
 "Last-Translator: aleisha <aleisha@catalyst.net.nz>\n"
 "Language-Team: Koha Translation Team\n"
@@ -10013,6 +10013,20 @@ msgstr "Unavailable (lost or missing)"
 msgid "Waiting at %s since %s"
 msgstr "Billing date: %s From %s To %s %s All since %s %s "
 
+#. For the first occurrence,
+#. SCRIPT
+#: koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc:78
+#: koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc:75
+#, fuzzy, c-format
+msgid "Waiting at %s since %s."
+msgstr "Billing date: %s From %s To %s %s All since %s %s "
+
+#. SCRIPT
+#: koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc:78
+#, fuzzy
+msgid "Waiting at %s, %s since %s."
+msgstr "Billing date: %s From %s To %s %s All since %s %s "
+
 #. For the first occurrence,
 #. SCRIPT
 #: koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc:78
@@ -10743,13 +10757,6 @@ msgstr "Dewey: %s "
 msgid "Pending hold"
 msgstr "Pending reserves"
 
-#. %1$s:  Branches.GetName(hold.get_column('branchcode')) | html 
-#. %2$s:  hold.waitingdate | $KohaDates 
-#: koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc:75
-#, fuzzy, c-format
-msgid "Waiting at %s since %s."
-msgstr "Billing date: %s From %s To %s %s All since %s %s "
-
 #. %1$s:  hold.reservedate | $KohaDates 
 #. %2$s:  Branches.GetName(hold.get_column('branchcode')) | html 
 #: koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc:77
@@ -10767,6 +10774,12 @@ msgstr "Item level hold forced from OPAC %s %s "
 msgid "Restricted"
 msgstr "Restricted"
 
+#. SCRIPT
+#: koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc:1
+#, fuzzy
+msgid "A patron from %s"
+msgstr "User library"
+
 #: koha-tmpl/intranet-tmpl/prog/en/includes/keyboard_shortcuts.inc:3
 #, c-format
 msgid "Insert copyright symbol (©)"
@@ -71662,10 +71675,6 @@ msgstr ""
 #~ msgid "A new version of this site is available. Load it?"
 #~ msgstr "A new version of this site is available. Load it?"
 
-#, fuzzy
-#~ msgid "A patron from %s"
-#~ msgstr "User library"
-
 #, fuzzy
 #~ msgid "A patron from another library"
 #~ msgstr "User library"
@@ -76391,10 +76400,6 @@ msgstr ""
 #~ msgid "View staff catalog biblio enhancement plugins"
 #~ msgstr "View online payment plugins"
 
-#, fuzzy
-#~ msgid "Waiting at %s, %s since %s."
-#~ msgstr "Billing date: %s From %s To %s %s All since %s %s "
-
 #, fuzzy
 #~ msgid "Waiting recall at %s since %s"
 #~ msgstr "Billing date: %s From %s To %s %s All since %s %s "
kohadev-koha@kohadevbox:po(main)$ 

I think the above is expected behaviour.

Can I please have some guidance on next steps i.e. "Notice the changes, you should see new translations added to the .po files. Ideally translate them, install the templates and confirm that the new strings are translated on the UI." <-- I'm not too sure what to do here
Comment 14 Katrin Fischer 2025-04-15 10:58:17 UTC
For checking the po files a tool like poedit can be helful, as it shows the number of untranslated strings etc. And allows to easily translate. If you want to change the file for testing you'd do this:

+
+#. SCRIPT
+#: koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc:78
+#, fuzzy
+msgid "Waiting at %s, %s since %s."
+msgstr "Billing date: %s From %s To %s %s All since %s %s "
+

* Remove fuzzy = fuzzy means it's not getting translated/translation won't be used
* Translate the msgstr line. The suggestion made here is obviously a bit wrong.