[Bug 11631] New: Make translation toolchain ignore useless translatable strings
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 Bug ID: 11631 Summary: Make translation toolchain ignore useless translatable strings Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: I18N/L10N Assignee: koha-bugs@lists.koha-community.org Reporter: pasi.kallinen@pttk.fi QA Contact: testopia@bugs.koha-community.org CC: frederic@tamil.fr Created attachment 24859 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=24859&action=edit Make i18n toolchain ignore useless strings There are several translatable strings which contain nothing but spaces and placeholders - these are useless for translators. Attached patch makes the translation toolchain ignore such strings. -- 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=11631 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|koha-bugs@lists.koha-commun |pasi.kallinen@pttk.fi |ity.org | -- 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=11631 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bgkriegel@gmail.com --- Comment #1 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- Hi, it works well, but only remove 74 strings Using this monster $tmpt =~ s/(%s|\s|\(|\)|\[|\]|\{|\}|\\|\.|\,|;|:|\||\-|\?|!|\'|\"|\#|\*|%%|\/|\=|\›)//g; removes 314 strings. But I don't know if that is considered good coding :-) -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #24859|0 |1 is obsolete| | --- Comment #2 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- Created attachment 26478 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=26478&action=edit [SIGNED-OFF] Bug 11631 - Make translation toolchain ignore useless "translatable" strings that contain nothing but spaces and/or placeholders. Test: 1) Update PO files of some lang, xx-YY-*po cd misc/translator perl translate update xx-YY 2) Do it again, just in case 3) rm po/xx-YY*po~ 4) Extract all msgid's, sorted cat po/xx-YY*po | egrep "^msgid" | sort | uniq > xx-YY-pre 5) Apply the patch 6) Repeat 1-3 7) Repeat 4 again, other file cat po/xx-YY*po | egrep "^msgid" | sort | uniq > xx-YY-post 8) Do a diff, inspect results, only strings with %s and \s diff xx-YY-pre xx-YY-post | less Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@biblibre.co | |m --- Comment #3 from Jonathan Druart <jonathan.druart@biblibre.com> --- Hello paxed, It is a very great improvement! Looking at the code, what do you think about replacing the temporary variable '$tmpt' and the substitution with only a match like next if $t =~ /^(%s|\s)*$/; ? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 --- Comment #4 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- Created attachment 26492 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=26492&action=edit Useless to translation strings Jonathan suggestion works. Using next if ( $t =~ /^(›|%%|%s|\s|\d|\.|,|;|:|\?|\!|\*|#|-|\+|x|=|~|<|>|\||\/|\\|\(|\)|\[|\]|\{|\}|"|')*$/ ); also catch more strings, see attached file. My question: Is there a better o more elegant way to write this? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 --- Comment #5 from Jonathan Druart <jonathan.druart@biblibre.com> --- (In reply to Bernardo Gonzalez Kriegel from comment #4)
My question: Is there a better o more elegant way to write this?
I agree with yours! I don't think we can write it better. We should compile the regex (using qr). Who does the patch? :) -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 --- Comment #6 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- Created attachment 26512 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=26512&action=edit Bug 11631 - Followup to extend and compile pattern This followup extendes and compile the pattern to test for useless strings To test: Same procedure as signed patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Needs Signoff --- Comment #7 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> ---
Who does the patch? :) Done!
Now this need a sign :) -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #26512|0 |1 is obsolete| | --- Comment #8 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- Created attachment 26522 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=26522&action=edit Bug 11631 - Followup to extend and compile pattern This followup extendes and compile the pattern to test for useless strings To test: Same procedure as signed patch Ammended patch, there is already a place for this check -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #26522|0 |1 is obsolete| | --- Comment #9 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- Created attachment 26834 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=26834&action=edit Bug 11631 - Followup to extend pattern This followup extendes and compile the pattern. Moved to proper place To test: Same procedure as signed patch Ammended patch, change description -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 paxed <pasi.kallinen@pttk.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #26478|0 |1 is obsolete| | Attachment #26492|0 |1 is obsolete| | Attachment #26834|0 |1 is obsolete| | --- Comment #10 from paxed <pasi.kallinen@pttk.fi> --- Created attachment 27522 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=27522&action=edit Make i18n toolchain ignore useless strings This is slightly improved version of bgkriegel's patch. -Punctuation is matched with POSIX character class [:punct:] instead of listing everything separately. -HTML entities are also matched - those are not meant to be translated anyway, and are mostly non-breaking spaces or quotes anyway. Test as per bgkriegel's patch above. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #27522|0 |1 is obsolete| | --- Comment #11 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- Created attachment 27527 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=27527&action=edit [SIGNED_OFF] Bug 11631: Make i18n toolchain ignore useless strings Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Works as described, 380 strings less to 'translate' No koha-qa errors. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #12 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Please always add the commit message to the test plan. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 --- Comment #13 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- ... the test plan to the commit message. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #27527|0 |1 is obsolete| | --- Comment #14 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- Created attachment 27659 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=27659&action=edit [SIGNED_OFF] Bug 11631: Make i18n toolchain ignore useless strings Copy of test plan: Test: 1) Update PO files of some lang, xx-YY-*po cd misc/translator perl translate update xx-YY 2) Do it again, just in case 3) rm po/xx-YY*po~ 4) Extract all msgid's, sorted cat po/xx-YY*po | egrep "^msgid" | sort | uniq > xx-YY-pre 5) Apply the patch 6) Repeat 1-3 7) Repeat 4 again, other file cat po/xx-YY*po | egrep "^msgid" | sort | uniq > xx-YY-post 8) Do a diff, inspect results, only strings with %s and \s diff xx-YY-pre xx-YY-post | less Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Works as described, 380 strings less to 'translate' No koha-qa errors. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 --- Comment #15 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- (In reply to Katrin Fischer from comment #13)
... the test plan to the commit message.
Not my patch, but my test plan :) -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #27659|0 |1 is obsolete| | --- Comment #16 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 27660 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=27660&action=edit [PASSED QA] Bug 11631: Make i18n toolchain ignore useless strings Test: 1) Update PO files of some lang, xx-YY-*po cd misc/translator perl translate update xx-YY 2) Do it again, just in case 3) rm po/xx-YY*po~ 4) Extract all msgid's, sorted cat po/xx-YY*po | egrep "^msgid" | sort | uniq > xx-YY-pre 5) Apply the patch 6) Repeat 1-3 7) Repeat 4 again, other file cat po/xx-YY*po | egrep "^msgid" | sort | uniq > xx-YY-post 8) Do a diff, inspect results, only strings with %s and \s diff xx-YY-pre xx-YY-post | less Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Works as described, 380 strings less to 'translate' No koha-qa errors. Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Tested according to test plan, works as described. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 Galen Charlton <gmcharlt@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |gmcharlt@gmail.com --- Comment #17 from Galen Charlton <gmcharlt@gmail.com> --- Pushed to master. Thanks, Pasi! -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11631 Fridolin SOMERS <fridolyn.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable CC| |fridolyn.somers@biblibre.co | |m --- Comment #18 from Fridolin SOMERS <fridolyn.somers@biblibre.com> --- Pushed to 3.14.x, will be in 3.14.07. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org