Bug 12207 - TTparser parses certain TT statements wrong
Summary: TTparser parses certain TT statements wrong
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: paxed
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-07 06:48 UTC by paxed
Modified: 2015-06-04 23:30 UTC (History)
2 users (show)

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


Attachments
Fix TT parsing when TT statement contains ] (1.65 KB, patch)
2014-05-07 06:57 UTC, paxed
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 12207: TTparser parses certain TT statements wrong (1.75 KB, patch)
2014-05-17 02:08 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 12207: TTparser parses certain TT statements wrong (1.80 KB, patch)
2014-05-21 10:56 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 paxed 2014-05-07 06:48:27 UTC
This piece of TT code in intranet-tmpl/prog/en/includes/authorities-search-results.inc:

  [% SWITCH lang %]
   [% CASE ['en', 'eng'] %]English
   [% CASE ['fr', 'fre'] %]French
   [% CASE ['it', 'ita'] %]Italian
    ...
   [% CASE %][% lang %]
  [% END %]


is parsed by the TTparser.pm wrong. In the po-files, it shows up as:

#. %7$s:  SWITCH lang 
#. %8$s: ERROR
#. %9$s: ERROR
   ...
#. %17$s:  CASE 
#. %18$s:  lang 
#. %19$s:  END 

All the "CASE [ ... ]" codes are shown as "ERROR".  This happens if any TT statement contains a ']' in it.
Comment 1 paxed 2014-05-07 06:57:45 UTC Comment hidden (obsolete)
Comment 2 Bernardo Gonzalez Kriegel 2014-05-17 02:08:06 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2014-05-21 10:56:05 UTC
Created attachment 28399 [details] [review]
Bug 12207: TTparser parses certain TT statements wrong

This piece of TT code:

  [% SWITCH lang %]
   [% CASE ['en', 'eng'] %]English
   [% CASE ['fr', 'fre'] %]French
   [% CASE ['it', 'ita'] %]Italian
    ...
   [% CASE %][% lang %]
  [% END %]

is parsed by the TTparser.pm wrong. In the po-files, it shows up as:

   ...

All the "CASE [ ... ]" codes are shown as "ERROR".
This happens if any TT statement contains a ']' in it - the TTParser
looks for anything that starts with [% and ends with ].

To test:

1)  cd misc/translator/
2)  perl translate update xx-YY
3)  for x in po/xx-YY-*.po; do cp "$x" "${x/.po/.po.bak}"; done
4)  apply patch
5)  perl translate update xx-YY
6)  for x in po/xx-YY-*.po; do diff -Nurd "$x" "${x/.po/.po.bak}"; done
      the only changed lines should be those that apply to msgid's with
      ERROR-parameters.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described. No errors

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 4 Galen Charlton 2014-05-23 15:28:16 UTC
Pushed to master and 3.16.x.  Thanks, Pasi!