Bug 29261 - Translation script breaks members/tables/members_results.tt
Summary: Translation script breaks members/tables/members_results.tt
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: translate.koha-community.org (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Martin Renvoize
URL:
Keywords:
Depends on: 15812
Blocks:
  Show dependency treegraph
 
Reported: 2021-10-18 08:51 UTC by Andrii Nugged
Modified: 2022-06-06 20:25 UTC (History)
3 users (show)

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


Attachments
Bug 29261: (bug 15812 follow-up) Fix translation issue in include file (3.11 KB, patch)
2021-10-18 09:10 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 29261: (bug 15812 follow-up) Fix translation issue in include file (3.17 KB, patch)
2021-10-18 10:15 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29261: (bug 15812 follow-up 2) Fix translation issue in include file (2.37 KB, patch)
2021-10-28 15:22 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 29261: (bug 15812 follow-up 3) Fix translation issue in include file (4.17 KB, patch)
2021-11-02 08:46 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andrii Nugged 2021-10-18 08:51:08 UTC
Got this in the errors log:

Template process failed: file error - parse error - /usr/share/koha/intranet/htdocs/intranet-tmpl/prog/fi-FI/modules/members/tables/members_results.tt line 6: unexpected token (data)


when compared to the original main place of the error localized here, such line:

                    "<a href=\"/cgi-bin/koha/members/moremember.pl?borrowernumber=[% data.borrowernumber | html %]\" class=\"patron_preview\" data-borrowernumber=\"[% data.borrowernumber | html %]\" style='white-space:nowrap' title='View'>[% INCLUDE 'patron-title.inc' borrowernumber = data.borrowernumber category_type = data.category_type firstname = data.firstname surname = data.surname othernames = data.othernames invert_name = 1 | $To %]</a><br /><div class='address'><ul>[%~ INCLUDE 'display-address-style' patron=data no_line_break=1 | $To ~%][% IF data.email %]<li>Email: <a href='mailto:[% data.email | html | $To %]'>[% data.email | html | $To %]</a></li>[% END %]</ul></div>",


broken by script and messed up:

                    "<a %]\"="%]\"" class="\"patron_preview\"" data-borrowernumber="\"[%" data.borrowernumber="data.borrowernumber" href="\"/cgi-bin/koha/members/moremember.pl?borrowernumber=[%" html="html" style="white-space:nowrap" title="Näytä" |="|">[% INCLUDE 'patron-title.inc' borrowernumber = data.borrowernumber category_type = data.category_type firstname = data.firstname surname = data.surname othernames = data.othernames invert_name = 1 | $To %]</a><br /><div class='address'><ul>[%~ INCLUDE 'display-address-style' patron=data no_line_break=1 | $To ~%][% IF data.email %]<li>Sähköposti: <a href='mailto:[% data.email | html | $To %]'>[% data.email | html | $To %]</a></li>[% END %]</ul></div>",
Comment 1 Jonathan Druart 2021-10-18 09:10:19 UTC
Created attachment 126416 [details] [review]
Bug 29261: (bug 15812 follow-up) Fix translation issue in include file

Strings must be surrounded by double quote or it wil break the translate
script.

Without this patch you get:
  5  "dt_name":
  6  "<a %]\"="%]\""
in the translated template and the UI explodes with "Template process
failed: file error - parse error"

Test plan:
Apply this patch, update PO files for a given language, translate
"View". Search for something like:
  msgid "\\\"View\\\""
  msgstr "\\\"Näytä\\\""
Remove fuzzy.
Install the language and search for patrons
Comment 2 Martin Renvoize 2021-10-18 10:15:22 UTC
Created attachment 126423 [details] [review]
Bug 29261: (bug 15812 follow-up) Fix translation issue in include file

Strings must be surrounded by double quote or it wil break the translate
script.

Without this patch you get:
  5  "dt_name":
  6  "<a %]\"="%]\""
in the translated template and the UI explodes with "Template process
failed: file error - parse error"

Test plan:
Apply this patch, update PO files for a given language, translate
"View". Search for something like:
  msgid "\\\"View\\\""
  msgstr "\\\"Näytä\\\""
Remove fuzzy.
Install the language and search for patrons

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 3 Martin Renvoize 2021-10-18 10:16:04 UTC
Tested as per the test plan, all works as expected. Signing off
Comment 4 Martin Renvoize 2021-10-19 13:55:28 UTC
I think we can safely go straight to PQA for this one.
Comment 5 Jonathan Druart 2021-10-21 08:33:16 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 6 Jonathan Druart 2021-10-28 15:22:36 UTC
Created attachment 127064 [details] [review]
Bug 29261: (bug 15812 follow-up 2) Fix translation issue in include file
Comment 7 Jonathan Druart 2021-10-28 15:45:35 UTC
(In reply to Jonathan Druart from comment #6)
> Created attachment 127064 [details] [review] [review]
> Bug 29261: (bug 15812 follow-up 2) Fix translation issue in include file

Pushed to master.
Comment 8 Jonathan Druart 2021-11-02 08:30:54 UTC
This didn't work, the original problem is still there.
Comment 9 Jonathan Druart 2021-11-02 08:46:47 UTC
Created attachment 127204 [details] [review]
Bug 29261: (bug 15812 follow-up 3) Fix translation issue in include file

This is getting messy. No idea how I tested the previous patches but it
was not working, the problem still persisted.

This patch is using the I18N TT plugin to make things easier and fix the
original problem.

Test plan:
Apply the patch
perl translate update fi-FI
Edit misc/translator/po/fi-FI-messages.po
Locate and translate "Check out"
 61 #: koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt:20
 62 msgid "Check out"
 63 msgstr "Laina"
Locate and transate "View"
 182 #: koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt:22
 183 msgid "View"
 184 msgstr "Nayta"
Apply the change to the fi-FI templates
perl translate install fi-FI

Now enable the fi-FI in the lang syspref, search for patron and confirm
that the result view is displayed correctly.
Note that the "Check out" and "View" strings are correctly translated
(when you hover the cardnumbers or patron's names)
Comment 10 Jonathan Druart 2021-11-03 14:41:28 UTC
Last patch pushed to master.