Bug 41769: Make ', by' string translatable in suggestions

This fixes a translation issue in the purchase suggestions
table in the staff interface - a ", by" is added between the
title and the author in the suggestion column, the "by" is
not translated when the language for the staff interface
is a language other than English.

Test plan:

1. Add another language to Koha:
   ./misc/translator/translate install fr-CA

2. Enable the new language in StaffInterfaceLanguages:
   2.1. Go to Administration > System preferences
   2.2. Search for StaffInterfaceLanguages
   2.3. Check the new language
   2.4. Click Save all I18N/L10N preferences

3. Create a new purchase suggestion:
   3.1. Go to More > Suggestions
   3.2. Click New purchase suggestion
   3.3. Fill out the title AND the author at least
   3.4. Click Submit your suggestion

4. View the suggestion in the table
   --> It says title, by author

5. Switch language
   --> The ", by" is still in English

6. Apply patch.

7. Run these commands to update the translation:
   7.1 ./misc/translator/translate update fr-CA
   7.2 ./misc/translator/translate install fr-CA

8. Reload page.

9. Notice that ", by" is now translated.
   --> in this instance, you will see ", par"

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 97b4b2f1db)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
This commit is contained in:
Ayoub Glizi-Vicioso 2026-03-02 16:54:09 -05:00 committed by Jacob O'Mara
parent 9d60ad2a37
commit ef28b9dedd
No known key found for this signature in database
1 changed files with 3 additions and 1 deletions

View File

@ -1373,7 +1373,9 @@
orderable: true,
render: function (data, type, row, meta) {
let node = '<a href="suggestion.pl?suggestionid=%s&amp;op=show" title="%s">%s'.format(row.suggestion_id, _("suggestion"), row.title);
if(row.author) node += ', by %s'.format(row.author);
if(row.author) {
node += ", %s %s".format(_("by"),row.author.escapeHtml());
}
node += '</a><br />';
if(row.copyright_date) node += ' &copy; <span class="suggestion_copyrightdate">%s</span>'.format(row.copyright_date);
if(row.volume_desc) node += '; <span class="suggestion_volume">%s:<em>%s</em></span>'.format(_("Volume"), row.volume_desc);