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.
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Bernardo Gonzalez Kriegel 2015-04-28 18:24:27 -03:00 committed by Tomas Cohen Arazi
parent 6844d9e6b5
commit 5caa05104d
1 changed files with 1 additions and 0 deletions

View File

@ -40,6 +40,7 @@ sub string_negligible_p {
|| $t =~ /^[-\+\.,:;!\?'"%\(\)\[\]\|]+$/ # punctuation w/o context
|| $t =~ /^[A-Za-z]$/ # single letters
|| $t =~ /^(&[a-z]+;|&#\d+;|&#x[0-9a-fA-F]+;|%%|%s|\s|[[:punct:]])*$/ # html entities,placeholder,punct, ...
|| ( $t =~ /^\[\%.*\%\]$/ and $t !~ /\%\].*\[\%/ ) # pure TT entities
)
}