There are two places (according to the translation tool) that have the string "On" used alone. The two cases have different contexts: In smtp_servers.tt, "On" is used in opposition to "Off" for the debugging mode. In itemsearch.tt, "On" is used for a date, "After [date]", "Before [date]", "On [date]" In French these would be two different words, but as it is, the same string is used in both cases.
+1
Created attachment 170881 [details] [review] 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 38415 #. For the first occurrence, 38416 #. SCRIPT 38417 #: koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt:327 38418 #: koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt:322 38419 #: koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt:324 38420 #, c-format 38421 msgid "On" 38422 msgstr "Sur " 3. Apply patch 4. Reupdate po files gulp po:update --lang fr-CA 5. Check the 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!) 6266 #: koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt:322 6267 #: koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt:324 6268 #, fuzzy 6269 msgctxt "On specific date" 6270 msgid "On" 6271 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. Optionally, translate the string and remove the "#fuzzy", install the translation and check the item search page --> It should use the string you put in
I made a patch for the itemsearch.tt page, but I need help for the smtp_servers.tt page. I tried to change return _("On"); for return _("On","Active"); return _p("Active", "On"); return _p('Active', 'On'); return __p("Active","On"); return __p('Active','On'); ... All of these effectively remove the string from fr-CA-staff-prog.po, but they don't add it back with the context in messages.po or message-js.po.
If you are in a .tt files writing JS code, you cannot use the JS functions defined in i18n.js (__, __p, etc.) Only strings within _() will be picked. You can however use the TT plugin: tp("Active", "On") Full code would be: "data": function( row, type, val, meta ) { if ( row.debug ) { return "[% tp("Active", "On") | html %]"; } else { return "[% tp("Active", "Off") | html %]"; } }, % gulp po:update --lang fr-FR % git grep -C 2 'msgctxt "Active"' fr-FR* fr-FR-messages.po-#: koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt:404 fr-FR-messages.po-#, fuzzy fr-FR-messages.po:msgctxt "Active" fr-FR-messages.po-msgid "On" fr-FR-messages.po-msgstr "Oman" fr-FR-messages.po- fr-FR-messages.po-#: koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt:407 fr-FR-messages.po:msgctxt "Active" fr-FR-messages.po-msgid "Off" fr-FR-messages.po-msgstr "" (No idea where "Oman" is coming from!)
Created attachment 171033 [details] [review] 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 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 Bug 37781: Add translation context for "On" (when used alone)
Thanks Jonathan! I added the context like you said and it works (not sure where the Oman comes from either lol). I had to do a little bit of more advanced git, hopefully I didn't lose anything and didn't make a mess of things either...
Created attachment 171169 [details] [review] 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>
Created attachment 171188 [details] [review] 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>
Pushed for 24.11! Well done everyone, thank you!