Bug 12192 - Template toolkit code in HTML attributes is picked up into po-files
Summary: Template toolkit code in HTML attributes is picked up into po-files
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Bernardo Gonzalez Kriegel
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-06 05:17 UTC by paxed
Modified: 2015-12-03 22:03 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 12192: Template toolkit code in HTML attributes is picked up into po-files (1.58 KB, patch)
2015-04-28 21:44 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12192: Template toolkit code in HTML attributes is picked up into po-files (1.64 KB, patch)
2015-04-29 08:53 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 12192: Template toolkit code in HTML attributes is picked up into po-files (1.76 KB, patch)
2015-04-30 06:09 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 paxed 2014-05-06 05:17:40 UTC
If TT code is used in title, alt, value, label, etc. attribute, the code is picked up into the po-files as-is, instead of replacing it with a placeholder.

For example:

<a href="[% url %]" title="Remove facet [% facet.facet_link_value | html %]">x</a>

shows up in the po-files as:

msgid "Remove facet [% facet.facet_link_value | html %]"
Comment 1 Marc Véron 2014-05-06 12:22:45 UTC
I asked about this bug on the list [koha-translate]:

can we translate things like
"Remove facet [% facet.facet_link_value | html %]"
to something like
"My translation  [% facet.facet_link_value | html %]"

... and got following answer from bkriegel: 

"It's the way I plan to traslate myself :)
I tested and it translates Ok"

Thanks, Bernardo.

I change status to RESOLVED INVALID.
Comment 2 paxed 2014-05-06 15:06:50 UTC
So the translators need to learn TT code? It really should be replaced with a "%s" placeholder, just like all the rest of the TT code in msgid's
Comment 3 Bernardo Gonzalez Kriegel 2014-05-06 16:01:52 UTC
I don't tell that this is not a bug, 
It need to be fixed somehow, I only answered what we can do for now.

Status NEW is ok in this case
Comment 4 Bernardo Gonzalez Kriegel 2015-04-28 21:44:05 UTC Comment hidden (obsolete)
Comment 5 Jonathan Druart 2015-04-29 08:53:28 UTC Comment hidden (obsolete)
Comment 6 Katrin Fischer 2015-04-30 06:09:49 UTC
Created attachment 38713 [details] [review]
Bug 12192: Template toolkit code in HTML attributes is picked up into po-files

This patch gives a partial solution for this problem.
It ignores strings like "[% something %]", but not
"[% IF ( value )  %][% value %][% END %]"

We get 100+ strings less to translate

To test:
1) Update translation files for your preferred language
2) Apply the patch
3) Update again
4) Compare, you must find 100+ strings removed from
translation files

eg.
-msgid "[% SEARCH_RESULT.biblionumber |url %]"
-msgid "[% accepteddate | $KohaDates %]"
-msgid "[% amountoutstanding | format('%.2f') %]"
-msgid "[% authtypetext |html %]"
-msgid "[% barcode_llx |html %]"
-msgid "[% barcode_lly |html %]"
-msgid "[% biblio.quantity.length ? biblio.quantity : 1 %]"
-msgid "[% billingdate | $KohaDates %]"
-msgid "[% borname |html %]"
...

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Verified all strings removed from the po files were
pure TT.
Comment 7 Tomás Cohen Arazi (tcohen) 2015-05-06 13:45:55 UTC
Great improvement Bernardo. Thanks!

Pushed to master.
Comment 8 Chris Cormack 2015-05-17 05:53:49 UTC
Pushed to 3.18.x will be in 3.18.7