Bug 33077 - Improve ease of translating template title tags
Summary: Improve ease of translating template title tags
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Owen Leonard
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on: 15395
Blocks:
  Show dependency treegraph
 
Reported: 2023-02-27 15:22 UTC by Owen Leonard
Modified: 2023-12-28 20:44 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.05,22.05.13,21.11.21


Attachments
Bug 33077: Improve ease of translating template title tags (2.62 KB, patch)
2023-02-27 18:34 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 33077: Improve ease of translating template title tags (2.70 KB, patch)
2023-03-06 17:27 UTC, Caroline Cyr La Rose
Details | Diff | Splinter Review
Bug 33077: Improve ease of translating template title tags (2.75 KB, patch)
2023-04-08 22:58 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2023-02-27 15:22:12 UTC
Title tags (<title>) in templates present an especially difficult case for translators because we can't use our usual trick of wrapping text elements with <span>. This results in strings like this waiting for translation:

#: koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt:6
#, c-format
msgid ""
"%s %s Modify city %s New city %s &rsaquo; %s %s Confirm deletion of city "
"&rsaquo; %s %s Cities &rsaquo; Administration &rsaquo; Koha "

We can instead use the i18n template plugin introduced by Bug 15395 to wrap individual title tag elements like so:

[% t("Modify city") | html %]
Comment 1 Owen Leonard 2023-02-27 18:34:45 UTC Comment hidden (obsolete)
Comment 2 Caroline Cyr La Rose 2023-03-06 17:27:05 UTC Comment hidden (obsolete)
Comment 3 Caroline Cyr La Rose 2023-03-06 17:31:44 UTC
Sorry for my confusion! It works well for cities!

Will this also work with titles with variables in them? For example on moremember.pl the title is "Patron details for name (cardnumber)..."
Comment 4 Katrin Fischer 2023-04-08 22:58:22 UTC
Created attachment 149333 [details] [review]
Bug 33077: Improve ease of translating template title tags

This patch uses the cities administration page as a proof-of-concept for
using the [% t() %] construction to wrap translatable string in template
<title> tags. This should result in a significant improvement in
translatability.

To test, apply the patch and run the translation script to update the
.po files, e.g.

perl misc/translator/translate update fr-FR

Check the updated .po files:

 - In fr-FR-staff-prog.po you should no longer see a reference to
   cities.tt line 6, "#: koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt:6"
 - In fr-FR-messages.po you should see several strings which have been
   pulled individually from the <title> tag:
   - cities.tt:9, msgid "Modify city"
   - cities.tt:11, msgid "New city"
   - cities.tt:15, msgid "Confirm deletion of city"
   - cities.tt:19, msgid "Administration", msgid "Cities", msgid "Koha",
     and msgid "Administration"

Translate the strings in fr-FR-messages.po and install the updated
translation:

perl misc/translator/translate install fr-FR

Swith to the update language in the staff interface and confirm that the
Cities page title is translated correctly.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Tomás Cohen Arazi 2023-04-12 14:44:16 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 6 Matt Blenkinsop 2023-04-17 09:11:13 UTC
Nice work everyone!

Pushed to stable for 22.11.x
Comment 7 Lucas Gass 2023-05-05 22:06:51 UTC
Backported to 22.05.x for upcoming 22.05.13.
Comment 8 Arthur Suzuki 2023-05-23 09:56:22 UTC
applied to 21.11 for 21.11.21