From 831f2a80dd037621c6dd982b69bb59cf7092d2e4 Mon Sep 17 00:00:00 2001 From: Kevin Carnes Date: Thu, 25 Apr 2024 09:30:20 +0200 Subject: [PATCH] Bug 36171: Incorrect translation of Template Toolkit directive causes patron view error in ru-RU It appears that the template parser parses HTML tags first and then template toolkit tags. This can cause a template toolkit tag that contains an HTML tag to have its start and end markers separated. This causes it to be treated as text that can be translated instead of a template toolkit tag. The template toolkit tags should probably be parsed first, but as a workaround the HTML tags in a template toolkit tag can be obfuscated. This patch uses concatenation as an example. To test: 1. You will need to edit the staff-prog.po for a language and modify the the translation for "SET line_break". You can change SET to FOO. 2. Install the translation for the language. 3. View the details of a patron in the staff interface with the language. 4. The page will have an error. 5. Apply the patch. 6. Install the translation for the language. 7. View the details of a patron in the staff interface with the language. 8. The page should now display correctly. If you want to, you can run "gulp po:update --lang LANGUAGE-CODE" to make sure that the template tag is no longer included in .po file. --- .../prog/en/includes/member-display-address-style.inc | 2 +- .../intranet-tmpl/prog/en/modules/admin/curbside_pickup.tt | 2 +- .../intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt | 2 +- .../opac-tmpl/bootstrap/en/includes/display-library-address.inc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style.inc index 83fa575bd1..1f23dbfb75 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/member-display-address-style.inc @@ -1,7 +1,7 @@ [%~ USE Koha ~%] [%~ USE raw ~%] [%~ BLOCK 'display-address-style' ~%] - [%~ SET line_break = "
" ~%] + [%~ SET line_break = "<" _ "br/>" ~%] [%~ IF no_line_break %][% SET line_break = " " %][% END ~%] [%~ IF Koha.Preference( 'AddressFormat' ) ~%] [%~ PROCESS "member-display-address-style-${ Koha.Preference( 'AddressFormat' ) }" ~%] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/curbside_pickup.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/curbside_pickup.tt index 7a2a532a7b..141003bd8a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/curbside_pickup.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/curbside_pickup.tt @@ -60,7 +60,7 @@

Curbside pickup configuration

[% UNLESS Koha.Preference('CurbsidePickup') %] - [% SET pref_CurbsidePickup_link = 'CurbsidePickup' %] + [% SET pref_CurbsidePickup_link = '<' _ 'a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=CurbsidePickup">CurbsidePickup<' _ '/a>' %]
The [% pref_CurbsidePickup_link | $raw | $KohaSpan %] preference is not enabled, do not forget to enable it to turn the feature on.
[% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt index 58a70e242b..1743321077 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt @@ -61,7 +61,7 @@ [% END %] [% UNLESS Koha.Preference( 'MARCOverlayRules' ) %] - [% SET pref_MARCOverlayRules_link = 'MARCOverlayRules' %] + [% SET pref_MARCOverlayRules_link = '<' _ 'a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=MARCOverlayRules">MARCOverlayRules<' _ '/a>' %]
The [% pref_MARCOverlayRules_link | $raw | $KohaSpan %] preference is not set, don't forget to enable it for rules to take effect.
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/display-library-address.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/display-library-address.inc index 5d129115c1..7f26800b8e 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/display-library-address.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/display-library-address.inc @@ -1,7 +1,7 @@ [%~ USE Koha ~%] [%~ USE raw ~%] [%~ BLOCK 'display-library-address' ~%] - [%~ SET line_break = "
" ~%] + [%~ SET line_break = "<" _ "br/>" ~%] [%~ IF no_line_break %][% SET line_break = " " %][% END ~%] [%~ IF Koha.Preference( 'AddressFormat' ) == "us" ~%] [%~ PROCESS 'display-library-address-us' ~%] -- 2.34.1