[Bug 13794] New: Input field values not translated
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 Bug ID: 13794 Summary: Input field values not translated Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: I18N/L10N Assignee: koha-bugs@lists.koha-community.org Reporter: maxime.beaulieu@inlibro.com QA Contact: testopia@bugs.koha-community.org CC: frederic@tamil.fr The template translation tool does not translate input field values. I have fixed a logical test marked by a #FIXME tag in tmpl_process3.pl. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 --- Comment #1 from Maxime Beaulieu <maxime.beaulieu@inlibro.com> --- Created attachment 36514 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=36514&action=edit 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. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 Maxime Beaulieu <maxime.beaulieu@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |philippe.blouin@inlibro.com -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 Maxime Beaulieu <maxime.beaulieu@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |eric.begin@inLibro.com -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 --- Comment #2 from Maxime Beaulieu <maxime.beaulieu@inlibro.com> --- Created attachment 36635 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=36635&action=edit Added "submit" in the list of input types. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 Maxime Beaulieu <maxime.beaulieu@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Input field values not |Text input field values not |translated |translated -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 Maxime Beaulieu <maxime.beaulieu@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #36514|0 |1 is obsolete| | Attachment #36635|0 |1 is obsolete| | --- Comment #3 from Maxime Beaulieu <maxime.beaulieu@inlibro.com> --- Created attachment 36637 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=36637&action=edit Bug 13794 - New patch, the old patches were likely to cause regression issues. I left the code logic intact, and simply removed "text" from the regex. Text input field values are now translated, no other logical changes are introduced. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bgkriegel@gmail.com --- Comment #4 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- Hi Maxime Is the patch ready to sign? I tried it anyway, I found no difference on translation files with the patch, have you an example of same untranslated text? Regards, Bernardo -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 --- Comment #5 from Maxime Beaulieu <maxime.beaulieu@inlibro.com> --- Changes will only appear if the template you are generating contains: <input type="text" name="translate" value="I wish to translate this"> And in the .po file: #. INPUT type=text name=translate #: pathToTemplate:lineNumber msgid "I wish to translate this" msgstr "Translated!" Without the patch tmpl_process3 will skip translation the value of the text input. With the patch the value is translated. In my case, the untranslated text appeared in a customized template. I figured I would put a word out on the possible issue just in case. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 --- Comment #6 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- (In reply to Maxime Beaulieu from comment #5)
Changes will only appear if the template you are generating contains:
<input type="text" name="translate" value="I wish to translate this">
And in the .po file:
#. INPUT type=text name=translate #: pathToTemplate:lineNumber msgid "I wish to translate this" msgstr "Translated!"
Without the patch tmpl_process3 will skip translation the value of the text input. With the patch the value is translated.
In my case, the untranslated text appeared in a customized template. I figured I would put a word out on the possible issue just in case.
Hi again, I found the following on current master: 1) Update a language 2) Add an input type 'text' as suggested e.g. on the first form of 'admin-home.tt', <input type="text" name="translate" value="I wish to translate this"> 3) Update again the language and diff staff PO file +#. INPUT type=text name=translate +#: intranet-tmpl/prog/en/modules/admin/admin-home.tt:25 +#, fuzzy +msgid "I wish to translate this" +msgstr "Título traducido: " And this "without" your patch!! Could you confirm? -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 --- Comment #7 from Maxime Beaulieu <maxime.beaulieu@inlibro.com> --- Hi Bernardo, The PO's are generated correctly, but the translation does not apply to the templates when 'translate install' is run. TEST: Create custom text input in the template fo your choice <input type="text" name="translate" value="I wish to translate this"> Run 'translate update [lang]' Check the appropriate [lang] po file and edit the translation for your input. Run 'translate install [lang]', the translated string does not appear. Apply the patch. Run 'translate install [lang]. The input is translated. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #36637|0 |1 is obsolete| | --- Comment #8 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- Created attachment 36767 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=36767&action=edit [SIGNED-OFF] Bug 13794: Text input field values not translated I left the code logic intact, and simply removed "text" from the regex. Text input field values are now translated, no other logical changes are introduced. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Test: 1) Update, install and enable es-ES language 2) Go to Reports > Acquisition wizard 3) On page bottom, there is a text field with the word 'Export' 4) Switch language, the word is not translated 5) Apply the patch 6) Update and install again es-ES language 7) Reload page, text now reads 'Exportar' No koha-qa errors. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |maxime.beaulieu@inlibro.com |ity.org | Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@biblibre.co | |m --- Comment #9 from Jonathan Druart <jonathan.druart@biblibre.com> --- I can confirm the patch work, but I cannot be sure it won't introduce regression The "text" have been added by commit db1660f512c52a9c848489f4e2e56516e99e1567 Author: acli <acli> Date: Mon Mar 8 04:59:38 2004 +0000 Fixed some bugs which caused some context to be not recognized, and some spurious context to be recognized. In particular, the bugs fixed are: 1. Failure to recognize INPUT element at the end, e.g., if the input has the form "Item number:%S", then the pattern was recognized as only "Item number". 2. Failure to remove matching <foo></foo> tags if the pattern contains INPUT or TMPL_VAR; e.g., if the input has the form "<h1>%s %s</h1>", the form would not be simplified to "%s %s". Unfortunately, fixing these 2 bugs will cause about 40 fuzzies to appear. But it did a lot of other stuffs. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 --- Comment #10 from Jonathan Druart <jonathan.druart@biblibre.com> --- Ok so, I tried to be sure no regression is added: $ git checkout bug_13794 $ cd misc/translator $ perl update es-ES $ perl install es-ES $ cp -r po/es-ES-i-staff-t-prog-v-3006000.po po/es-ES-opac-bootstrap.po po/es-ES-pref.po po/es-ES-staff-help.po ../../koha-tmpl/intranet-tmpl/prog/es-ES/ ../../koha-tmpl/opac-tmpl/bootstrap/es-ES /tmp/test_bug_13794 $ cd /tmp/test_bug_13794 $ git init;git add .; git commit -m"something" # back in my koha src $ git checkout master $ cd misc/translator $ perl update es-ES $ perl install es-ES $ cp -r po/es-ES-i-staff-t-prog-v-3006000.po po/es-ES-opac-bootstrap.po po/es-ES-pref.po po/es-ES-staff-help.po ../../koha-tmpl/intranet-tmpl/prog/es-ES/ ../../koha-tmpl/opac-tmpl/bootstrap/es-ES /tmp/test_bug_13794 $ cd /tmp/test_bug_13794 $ git diff | grep input | grep text | grep value | grep -v 'value=""' | grep -v 'value="\[\%'| vim - gives me the following: id="start_card" class="focus" title="Número de carné de inicio" size="5" name="start_card" value="1" /> - <label class="inline" for="basename">Nombre: </label> <input name="basename" value="Exportar" id="basename" type="text" /> + <label class="inline" for="basename">Nombre: </label> <input type="text" name="basename" id="basename" value="Export" /> - <label class="inline" for="basename">Nombre: </label><input value="Exportar" name="basename" id="basename" type="text" /> + <label class="inline" for="basename">Nombre: </label><input type="text" name="basename" id="basename" value="Export" /> - <label class="inline" for="basename">Nombre: </label><input name="basename" value="Exportar" id="basename" type="text" /> + <label class="inline" for="basename">Nombre: </label><input type="text" name="basename" id="basename" value="Export" /> - <label class="inline" for="basename">Nombre: </label><input type="text" id="basename" value="Exportar" name="basename" /> + <label class="inline" for="basename">Nombre: </label><input type="text" name="basename" id="basename" value="Export" /> - <label class="inline" for="basename">Nombre: </label><input value="Exportar" name="basename" id="basename" type="text" /> + <label class="inline" for="basename">Nombre: </label><input type="text" name="basename" id="basename" value="Export" /> - <label class="inline" for="basename">Nombre: </label><input name="basename" value="Exportar" id="basename" type="text" /> + <label class="inline" for="basename">Nombre: </label><input type="text" name="basename" id="basename" value="Export" /> - <label class="inline" for="basename">Nombre: </label><input value="Exportar" name="basename" id="basename" type="text" /> + <label class="inline" for="basename">Nombre: </label><input type="text" name="basename" id="basename" value="Export" /> - <label class="inline" for="basename">Nombre: </label><input value="Exportar" name="basename" id="basename" type="text" /> + <label class="inline" for="basename">Nombre: </label><input type="text" name="basename" id="basename" value="Export" /> - <label class="inline" for="basename">Nombre: </label><input name="basename" value="Exportar" id="basename" type="text" /> + <label class="inline" for="basename">Nombre: </label><input type="text" name="basename" id="basename" value="Export" /> - <label class="inline" for="basename">Nombre: </label><input name="basename" value="Exportar" type="text" id="basename" /> + <label class="inline" for="basename">Nombre: </label><input type="text" name="basename" id="basename" value="Export" /> con valor <input type="text" name="field_value" id="field_value" /> - <input value="Exportar" name="basename" type="text" id="basename" /> + <input type="text" name="basename" id="basename" value="Export" /> All looks good. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #36767|0 |1 is obsolete| | --- Comment #11 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 36816 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=36816&action=edit Bug 13794: Text input field values not translated I left the code logic intact, and simply removed "text" from the regex. Text input field values are now translated, no other logical changes are introduced. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Test: 1) Update, install and enable es-ES language 2) Go to Reports > Acquisition wizard 3) On page bottom, there is a text field with the word 'Export' 4) Switch language, the word is not translated 5) Apply the patch 6) Update and install again es-ES language 7) Reload page, text now reads 'Exportar' No koha-qa errors. Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |tomascohen@gmail.com --- Comment #12 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Patch pushed to master. Thanks Maxime! -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chris@bigballofwax.co.nz --- Comment #13 from Chris Cormack <chris@bigballofwax.co.nz> --- Changes translations held for 3.18.6 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable --- Comment #14 from Chris Cormack <chris@bigballofwax.co.nz> --- Pushed to 3.18.x will be in 3.18.6 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org