From 1cbd285a858eb8f987c8dcc2f2feea4560a812ef Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 18 Nov 2024 10:57:22 +0100 Subject: [PATCH] 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. --- .../includes/html_helpers/tables/items/catalogue_detail.inc | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc | 2 +- koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 2 +- koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc index f9cd7e81c99..ee5e80342c6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc @@ -522,9 +522,9 @@ if ( row.first_hold ) { if ( row.first_hold.waiting_date ) { if ( row.first_hold.desk ) { - nodes += '%s'.format(_("Waiting at %s, %s since %s.".format(row.first_hold._strings.pickup_library_id.str, row.first_hold.desk.desk_name, $date(row.first_hold.waiting_date)))); + nodes += '%s'.format(_("Waiting at %s, %s since %s.").format(row.first_hold._strings.pickup_library_id.str, row.first_hold.desk.desk_name, $date(row.first_hold.waiting_date))); } else { - nodes += '%s'.format(_("Waiting at %s since %s.".format(row.first_hold._strings.pickup_library_id.str, $date(row.first_hold.waiting_date)))); + nodes += '%s'.format(_("Waiting at %s since %s.").format(row.first_hold._strings.pickup_library_id.str, $date(row.first_hold.waiting_date))); } [% IF Koha.Preference('canreservefromotherbranches') %] if ( row.first_hold.waiting_date || row.first_hold.priority == 1 ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc index fd8463ba3a0..8b7ca40bed2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc @@ -38,7 +38,7 @@ } if ( name.replace(' ', '').length == 0 ) { - return _("A patron from %s".format(patron.library.name)); + return _("A patron from %s").format(patron.library.name); } if ( config && config.hide_patron_name ) { diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index 20fc1ea5ff7..c1215964746 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -386,7 +386,7 @@ function LoadIssuesTable() { } else if ( oObj.can_renew_error == "on_reserve" ) { return "" + __("On hold") + ""; } else if ( oObj.materials ) { - return __("Confirm (%s)".format(oObj.materials.escapeHtml())); + return __("Confirm (%s)").format(oObj.materials.escapeHtml()); } else { return ""; } diff --git a/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js b/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js index affe6ac4e02..b975d34173b 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js +++ b/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js @@ -149,7 +149,7 @@ $(document).ready(function () { var search_field_name = $(line).find('input[data-id="search_field_name"]').val(); let already_exists = dt.data().filter((row, idx) => row[0]['@data-order'] === search_field_name); if ( already_exists.length ) { - alert(__("Search field '%s' already exists".format(search_field_name))); + alert(__("Search field '%s' already exists").format(search_field_name)); return; } if (search_field_name.length > 0) { @@ -171,7 +171,7 @@ $(document).ready(function () { let dt_data = dt.data(); let already_exists = dt_data.filter((row, idx) => row[1] === search_field_name); if ( already_exists.length ) { - alert(__("Facet '%s' already exists".format(search_field_name))); + alert(__("Facet '%s' already exists").format(search_field_name)); return; } if (search_field_name.length > 0) { -- 2.34.1