Summary: | Add translation context for "On" (when used alone) | ||
---|---|---|---|
Product: | Koha | Reporter: | Caroline Cyr La Rose <caroline.cyr-la-rose> |
Component: | I18N/L10N | Assignee: | Caroline Cyr La Rose <caroline.cyr-la-rose> |
Status: | RESOLVED FIXED | QA Contact: | Jonathan Druart <jonathan.druart> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | f.demians, jonathan.druart, lucas |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | String patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: |
This enhancement adds translation context to the word "On" when it is used alone. In the item search page, it means "on a specific date", and on the SMTP server administration page, it means "on" as in "not off". The translation context separates the two strings so that they can be translated individually.
|
Version(s) released in: |
24.11.00
|
Circulation function: | |||
Attachments: |
Bug 37781: Add translation context for "On" (when used alone)
Bug 37781: Add translation context for "On" (when used alone) Bug 37781: Add translation context for "On" (when used alone) Bug 37781: Add translation context for "On" (when used alone) |
Description
Caroline Cyr La Rose
2024-08-29 19:01:48 UTC
+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! |