Bug 34310 - Input prompt in datatables column search boxes untranslatable
Summary: Input prompt in datatables column search boxes untranslatable
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-19 15:50 UTC by Caroline Cyr La Rose
Modified: 2024-12-23 08:06 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial 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
Circulation function:


Attachments
Bug 34310: Input prompt in datatables column search boxes untranslatable (2.11 KB, patch)
2023-07-20 11:51 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 34310: Input prompt in datatables column search boxes untranslatable (2.18 KB, patch)
2023-07-20 18:43 UTC, Caroline Cyr La Rose
Details | Diff | Splinter Review
Bug 34310: Input prompt in datatables column search boxes untranslatable (2.23 KB, patch)
2023-09-06 03:12 UTC, David Cook
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Caroline Cyr La Rose 2023-07-19 15:50:19 UTC
When viewing a table (for example, the memberresultst table), there are search boxes under each column heading. The prompt inside these boxes say, for example "Card search", "Name search", "Date of birth search", etc.

When I switch the interface in French or German, the Card/Name/Date of birth parts are translated, but "search" part is not translated. 

I cannot find the string to translate this. It would need to be "%s search" so we can move the words around.

To replicate:
1. In the staff interface, go to Patrons
2. Click the Search button on the left
--> Search results appear in a table, search boxes have prompts like "Card search"
3. Optionally, switch the interface to another language
--> Only the column name part (e.g. Card) is translated
Comment 1 Owen Leonard 2023-07-20 11:51:24 UTC Comment hidden (obsolete)
Comment 2 Caroline Cyr La Rose 2023-07-20 18:43:59 UTC
Created attachment 153742 [details] [review]
Bug 34310: Input prompt in datatables column search boxes untranslatable

This patch corrects the internationalization function wrapped around the
"% search" string in datatables.js. It should be the double-underscore
function instead of the single-underscore.

To test, apply the patch and test that the placeholder string is
translatable. In this example I'm testing fr-FR:

- Update a translation:

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

- Open the corresponding .po file for the strings pulled from
  JavaScript  e.g.  misc/translator/po/fr-FR-messages-js.po
  - Locate strings pulled from prog/js/datatables.js for
    translation, e.g.:

    \#: koha-tmpl/intranet-tmpl/prog/js/datatables.js:894
    \#, javascript-format
    msgid "%s search"
    msgstr "%s recherche"

  - Install the updated translation:

    > perl translate install fr-FR

In the staff interface, test a page that has column header filters, e.g.
patron search. Confirm that the table of search results shows the
translated string in the column header placeholders.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Comment 3 Caroline Cyr La Rose 2023-07-20 18:44:14 UTC
Thanks Owen!
Comment 4 David Cook 2023-09-06 03:10:54 UTC
There is a little issue with the aria-label for "Expires on" but that's unrelated to this change.
Comment 5 David Cook 2023-09-06 03:12:03 UTC
Created attachment 155252 [details] [review]
Bug 34310: Input prompt in datatables column search boxes untranslatable

This patch corrects the internationalization function wrapped around the
"% search" string in datatables.js. It should be the double-underscore
function instead of the single-underscore.

To test, apply the patch and test that the placeholder string is
translatable. In this example I'm testing fr-FR:

- Update a translation:

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

- Open the corresponding .po file for the strings pulled from
  JavaScript  e.g.  misc/translator/po/fr-FR-messages-js.po
  - Locate strings pulled from prog/js/datatables.js for
    translation, e.g.:

    \#: koha-tmpl/intranet-tmpl/prog/js/datatables.js:894
    \#, javascript-format
    msgid "%s search"
    msgstr "%s recherche"

  - Install the updated translation:

    > perl translate install fr-FR

In the staff interface, test a page that has column header filters, e.g.
patron search. Confirm that the table of search results shows the
translated string in the column header placeholders.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Comment 6 Tomás Cohen Arazi (tcohen) 2023-09-08 14:54:16 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 7 Fridolin Somers 2023-09-08 19:52:37 UTC
This should be in QA tools :
https://gitlab.com/koha-community/qa-test-tools/-/issues/55

Or in test suite.
Comment 8 Fridolin Somers 2023-09-08 19:53:21 UTC
Pushed to 23.05.x for 23.05.04
Comment 9 Matt Blenkinsop 2023-09-15 10:08:48 UTC
Nice work everyone!

Pushed to oldstable for 22.11.x