From 0b12b333b31187acc8db95143d25edca3aaef474 Mon Sep 17 00:00:00 2001
From: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Date: Thu, 29 Aug 2024 16:36:15 -0400
Subject: [PATCH] Bug 37781: Add translation context for "On" (when used alone)

This patch adds context to the string "On" used alone in the item search
page, to mean "On a specific date".

To test:
1. Update translation files

gulp po:update --lang fr-CA

2. Check the staff-prog.po file and search for "On".

vi misc/translator/po/fr-CA-staff-prog.po

/"On"

   --> It should be in three places, two in itemsearch.tt and
       one in smtp_servers.tt

 #. For the first occurrence,
 #. SCRIPT
 #: koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt:327
 #: koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt:322
 #: koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt:324
 #, c-format
 msgid "On"
 msgstr "Sur "

3. Apply patch
4. Reupdate po files

gulp po:update --lang fr-CA

5. Check the misc/translator/po/fr-CA-messages.po file and search for "On"

    --> There should be a msgctxt line that adds context to the
        "On" (please ignore the translated msgstr, I have no idea
        how it decides what to put in there!)

 #: koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt:404
 #, fuzzy
 msgctxt "Active"
 msgid "On"
 msgstr "Oman"

 #: koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt:322
 #: koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt:324
 #, fuzzy
 msgctxt "On specific date"
 msgid "On"
 msgstr "Oman"

6. Also check the item search page
   --> It should still work and the "On" in the last borrowed date
       drop-down should still say "On"

7. In the SMTP servers page, add a server and enable the "Debug" mode.
   --> In the list of servers, the Debug column should still say simply
       "On"

8. Optionally, translate the string and remove the "#fuzzy" line,
   install the translation and check the item search page
   --> It should use the string you put in

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
---
 koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt | 2 +-
 .../intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt
index d788a726c3c..38a719c511b 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt
@@ -401,7 +401,7 @@
                     {
                         "data": function( row, type, val, meta ) {
                             if ( row.debug ) {
-                                return _("On");
+                                return "[% tp("Active", "On") | html %]";
                             }
                             else {
                                 return _("Off");
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt
index 241606d311e..f0eb2666ec1 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt
@@ -319,9 +319,9 @@
                   <option value="<">Before</option>
                 [% END %]
                 [% IF query.param('datelastborrowed_op') == '=' %]
-                  <option value="=" selected="selected">On</option>
+                  <option value="=" selected="selected">[% tp('On specific date', 'On') | html %]</option>
                 [% ELSE %]
-                  <option value="=">On</option>
+                  <option value="=">[% tp('On specific date', 'On') | html %]</option>
                 [% END %]
               </select>
               <input type="text" name="datelastborrowed" value="[% query.param('datelastborrowed') | html %]"/>
-- 
2.34.1