Bugzilla – Attachment 36514 Details for
Bug 13794
Text input field values not translated
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Fixed logical test in tmpl_process3.pl
Fixed-logical-test-in-tmplprocess3pl.patch (text/plain), 2.23 KB, created by
Maxime Beaulieu
on 2015-03-04 22:10:58 UTC
(
hide
)
Description:
Fixed logical test in tmpl_process3.pl
Filename:
MIME Type:
Creator:
Maxime Beaulieu
Created:
2015-03-04 22:10:58 UTC
Size:
2.23 KB
patch
obsolete
>From af1f3118371108845e9944bf284ae022c922b977 Mon Sep 17 00:00:00 2001 >From: mxbeaulieu <maxime.beaulieu@inlibro.com> >Date: Wed, 4 Mar 2015 16:51:22 -0500 >Subject: [PATCH] Fixed logical test in tmpl_process3.pl > >The line: >next if $a eq 'value' && ($tag ne 'input' || (ref $attr->{'type'} && $attr->{'type'}->[1] =~ /^(?:checkbox|hidden|radio|text)$/)); # FIXME > >This portion: (ref $attr->{'type'} && $attr->{'type'}->[1] =~ /^(?:checkbox|hidden|radio|text)$/) checks if the input type is valid. > >We get the following (wrong) logic: >next IF >$a eq value > AND >the tag is not an input OR the input type is valid > >The test is true when : $a eq value, tag is an input, input type is valid >We skip the tag when it is valid, it is never translated. > >I propose the following change: > my $isValidType = ref $attr->{'type'} && $attr->{'type'}->[1] =~ /^(?:checkbox|hidden|radio|text)$/; > next if $a eq 'value' && !($tag eq 'input' && $isValidType); > >next IF >$a eq value > AND >NOT ( tag is an input AND input type is valid ) >in short: NOT (tag is a valid input tag) > >[ Alternative ] ( Not included in patch ) >next if $a eq 'value' && ($tag ne 'input' || (ref $attr->{'type'} && $attr->{'type'}->[1] !~ /^(?:checkbox|hidden|radio|text)$/)); >No extra variable, at the cost of code readability. > >http://bugs.koha-community.org/show_bug.cgi?id=13794 >--- > misc/translator/tmpl_process3.pl | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/misc/translator/tmpl_process3.pl b/misc/translator/tmpl_process3.pl >index cb671ae..c9dfa4e 100755 >--- a/misc/translator/tmpl_process3.pl >+++ b/misc/translator/tmpl_process3.pl >@@ -64,8 +64,8 @@ sub text_replace_tag ($$) { > if ($attr->{$a}) { > next if $a eq 'label' && $tag ne 'optgroup'; > next if $a eq 'content' && $tag ne 'meta'; >- next if $a eq 'value' && ($tag ne 'input' || (ref $attr->{'type'} && $attr->{'type'}->[1] =~ /^(?:checkbox|hidden|radio|text)$/)); # FIXME >- >+ my $isValidType = ref $attr->{'type'} && $attr->{'type'}->[1] =~ /^(?:checkbox|hidden|radio|text)$/; >+ next if $a eq 'value' && !($tag eq 'input' && $isValidType); > my($key, $val, $val_orig, $order) = @{$attr->{$a}}; #FIXME > if ($val =~ /\S/s) { > my $s = find_translation($val); >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13794
:
36514
|
36635
|
36637
|
36767
|
36816