Bug 30729 - Template toolkit comments are caught in the translatable strings
Summary: Template toolkit comments are caught in the translatable strings
Status: RESOLVED DUPLICATE of bug 33332
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-10 20:56 UTC by Victor Grousset/tuxayo
Modified: 2023-06-18 10:46 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:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Grousset/tuxayo 2022-05-10 20:56:46 UTC
I was checking the untranslated strings for 22.05 and noticed template toolkit comments are caught in the translatable strings.

For example this string:
%%] [%%# - category:␠
https://translate.koha-community.org/fr/22.05/translate/fr-FR-staff-prog.po#unit=22438387

It comes from koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc

[%# Display a complex patron search form %]
[%# - Search: <input> %]
[%# You can then pass a list of filters %]
[%# - branch: <select library list> %]
[%# - category: <select patron category list> %]
[%# - search_field: <select patron field list> %]
[%# - search_type: <select "contain" or "start with"> %]
Comment 1 Bernardo Gonzalez Kriegel 2022-05-17 20:22:18 UTC
Many strings are analyzed and extracted using misc/translator/xgettext.pl.
It has a way to detect strings that wants to keep and which to discard.
Normally a line with pure TT ( ^[%.*%]$/ ) is discarded, but it reacts quickly to anything resembling an HTML tag.

In this case the TT comment 
[%# Display a complex patron search form %]
[%# - Search: <input> %]
[%# You can then pass a list of filters %]
[%# - branch: <select library list> %]
[%# - category: <select patron category list> %]
[%# - search_field: <select patron field list> %]
[%# - search_type: <select "contain" or "start with"> %]
is using things inside <.*>, and poor xgettext.pl is confused.

Changing the comment to
[%# Display a complex patron search form %]
[%# - Search: "input" %]
[%# You can then pass a list of filters %]
[%# - branch: "select library list" %]
[%# - category: "select patron category list" %]
[%# - search_field: "select patron field list" %]
[%# - search_type: "select 'contain' or 'start with'"> %]
eliminates the confusion and preserves, I think, the spirit of the comment, and fixes the problem.

To test:
cd misc/translator
mkdir test
cp ../../koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc test/.
echo test/patron-search.inc > test.list
./xgettext.pl -f test.list -s -o test.po

The file test.po contains those strange strings, from the comment.
Edit test/patron-search.inc changing the comment as suggested,
repeat the last run and check that the strange strings are gone.

It's either that or teach new skills to xgettext.pl

I haven't been able to find any other cases that didn't come from that file.
Comment 2 Katrin Fischer 2023-06-18 10:46:21 UTC
We have started to fix those by making sure we don't use multi-line comments. This way they don't end up in po files.

*** This bug has been marked as a duplicate of bug 33332 ***