From a26eb3fdfaa3811f45a48f9fd51118225d768a8f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 6 Nov 2024 14:19:26 +0100 Subject: [PATCH] Bug 38377: Improve translatability of "%s/%s renewals remaining" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See comment 0 The sentence in English: "2 of 3 renewals remaining" is translated as "2 uzatma hakkınızdan 3 tane kaldı" in Turkish. This is wrong. Right Turkish translation must be like this : "3 uzatma hakkınızdan 2 tane kaldı" We cannot use %s/%s as the order will be preserved, we need to use named placeholders. Test plan: Apply this patch % gulp po:update --lang LANG Go to misc/translator/po % git grep 'renewals remaining' Translate the occurrences, remove fuzzy sudo koha-translate --update LANG --dev kohadev restart_all Enable LANG for both staff and OPAC Have a look at the checkouts table and notice that the strings have been correctly translated --- koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 4 ++-- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index 0802d15bb43..58b5bd01278 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -363,9 +363,9 @@ function LoadIssuesTable() { content += msg; if ( can_renew || can_force_renew ) { content += "("; - content += __("%s of %s renewals remaining").format(oObj.renewals_remaining, oObj.renewals_allowed); + content += __x("{renewals_left} of {renewals_allowed} renewals remaining", {renewals_left: oObj.renewals_remaining, renewals_allowed: oObj.renewals_allowed}); if (UnseenRenewals && oObj.unseen_allowed) { - content += __(" and %s of %s unseen renewals remaining").format(oObj.unseen_remaining, oObj.unseen_allowed); + content += __x(" and {renewals_left} of {renewals_allowed} unseen renewals remaining", {renewals_left: oObj.unseen_remaining, renewals_allowed: oObj.unseen_allowed}); } content += ")"; } diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index b6780c18f56..c37b8b1578a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -3,6 +3,7 @@ [% USE Koha %] [% USE KohaDates %] [% USE Branches %] +[% USE I18N %] [% USE ItemTypes %] [% USE Price %] [% USE AuthorisedValues %] @@ -465,7 +466,7 @@ [% ISSUE.itemtype_object.rentalcharge_hourly | $Price %] per hour [% END %] ( - [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining + [% I18N.tx("{renewals_left} of {renewals_allowed} renewals remaining", { renewals_left = ISSUE.renewsleft, renewals_allowed = ISSUE.renewsallowed }) %] [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %] / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library [% END %] @@ -483,7 +484,7 @@ [% ELSIF ISSUE.auto_too_much_oweing %] Automatic renewal failed, you have unpaid fines. ( - [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining + [% I18N.tx("{renewals_left} of {renewals_allowed} renewals remaining", { renewals_left = ISSUE.renewsleft, renewals_allowed = ISSUE.renewsallowed }) %] [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %] / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library [% END %] @@ -491,7 +492,7 @@ [% ELSIF ISSUE.auto_account_expired %] Automatic renewal failed, your account is expired. ( - [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining + [% I18N.tx("{renewals_left} of {renewals_allowed} renewals remaining", { renewals_left = ISSUE.renewsleft, renewals_allowed = ISSUE.renewsallowed }) %] [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %] / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library [% END %] @@ -499,7 +500,7 @@ [% ELSIF ( ISSUE.too_soon ) %] No renewal before [% ISSUE.soonestrenewdate | $KohaDates as_due_date => 1 %] ( - [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining + [% I18N.tx("{renewals_left} of {renewals_allowed} renewals remaining", { renewals_left = ISSUE.renewsleft, renewals_allowed = ISSUE.renewsallowed }) %] [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %] / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library [% END %] @@ -805,7 +806,7 @@ Renew [% END %] ( - [% OVERDUE.renewsleft | html %] of [% OVERDUE.renewsallowed | html %] renewals remaining + [% I18N.tx("{renewals_left} of {renewals_allowed} renewals remaining", { renewals_left = OVERDUE.renewsleft, renewals_allowed = OVERDUE.renewsallowed }) %] [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %] / [% OVERDUE.unseenleft | html %] of [% OVERDUE.unseenallowed | html %] renewals left before the item must be seen by the library [% END %] -- 2.34.1