[Bug 9161] New: Translate only one specific file
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9161 Bug ID: 9161 Summary: Translate only one specific file Classification: Unclassified Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: translate.koha-community.org Assignee: koha-bugs@lists.koha-community.org Reporter: jonathan.druart@biblibre.com CC: frederic@tamil.fr Contrary to the POD say, it is not possible to translate only one file. Very usefull for debug. -- 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=9161 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |jonathan.druart@biblibre.co |ity.org |m -- 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=9161 --- Comment #1 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 13728 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=13728&action=edit Bug 9161: translate only 1 specific file The previous version of tmpl_process3.pl says in the pod: -i, --input=SOURCE Get or update strings from SOURCE file. SOURCE is a directory if -r is also specified. But is was not possible to specify one or more file. This patch allows us to give one or more specific file with the -f parameter. for eg.: perl tmpl_process3.pl install -i /home/koha/koha-tmpl/opac-tmpl/prog/en/modules/ -o /home/koha/koha-tmpl/opac-tmpl/prog/fr-FR/modules/ -s /home/koha/misc/translator/po/fr-FR-i-opac-t-prog-v-3006000.po -r -f opac-account.tt -f opac-main.tt -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9161 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Patch complexity|--- |Medium patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9161 --- Comment #2 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 13729 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=13729&action=edit MT9161: Followup change the maching test you can specify -f advsearch.tt => translate all files with a filename containing 'advsearch.tt' or -f search => will translate acqui/histsearch.tt, acqui/z3950_search.tt, etc. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9161 --- Comment #3 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 13731 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=13731&action=edit Bug 9161: Followup: Add a -f param for the translate script Now you can directly call the translate script (misc/translator/translate) with the -f parameter eg.: ./translate install|create|update -f search.tt -f main.tt -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9161 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Translate only one specific |Translate only specific |file |files -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9161 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #13728|0 |1 is obsolete| | Attachment #13729|0 |1 is obsolete| | Attachment #13731|0 |1 is obsolete| | --- Comment #4 from Frédéric Demians <frederic@tamil.fr> --- Created attachment 14208 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=14208&action=edit Signed-off patch I've squashed the 3 patches, and reported doc into 'translate' script. It works as advertised. Side note: It would be great to extend this functionnality in order to be able to apply the translation to XSL files stored outside Koha directories hierarchy. Useful to translate site-specific XSLs defined with XSLTResultsDisplay, and other sysprefs. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9161 Frédéric Demians <frederic@tamil.fr> 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=9161 --- Comment #5 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 14914 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=14914&action=edit Bug 9161: Followup: the -f param does not work correctly Without this patch, the -f param (for the translate script) add the modified line in the po file BUT comment all lines from others files. This patch concat the generated file with the previous one and merge them. This way produce a pretty po file with all our strings :) + Modification in LangInstaller.pm to fix a bug when the -f param was not given. Test plan: 1/ Update your po file : cd misc/translator perl translate update fr-FR git commit -a -m"TMP PO" 2/ Modification on 2 files: ie. catalogue/advsearch.tt:32 <h1>Advanced search Foo</h1> catalogue/issuehistory.tt:38 <th>Patron Bar</th> 3/ Update your po file with only the first file: perl translate update fr-FR -f advsearch.tt 4/ Edit your po file and check that only the foo string is present (or git diff). 5/ Update your po file with only the second file: perl translate update fr-FR -f issuehistory 6/ Edit your po file and check that 2 strings are present (or git diff). 7/ Change the translation for these 2 strings and delete the fuzzy lines. 8/ Install the first file for your language: perl translate install fr-FR -f advsearch.tt 9/ Edit your translated file and verify the string is translated. Check that the issuehistory.tt file is not changed. 10/ Same for issuehistory: perl translate install fr-FR -f issuehistory 11/ stash your modification in your tt files (or reset --hard): git stash 12/ Check in your po file that the 2 strings are commented (git diff). 13/ To finish, install all template files and check that they are replaced correctly: perl translate install fr-FR -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9161 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9161 --- Comment #6 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 14997 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=14997&action=edit Bug 9161: Allow to specificy a complete relpath instead of a filename Now you can call the translate script with a -f parameter containing a complete relpath (koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt or admin/preferences.tt for e.g.) -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9161 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #14914|0 |1 is obsolete| | Attachment #14997|0 |1 is obsolete| | --- Comment #7 from Frédéric Demians <frederic@tamil.fr> --- Created attachment 15207 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=15207&action=edit Signed-off patch (merged follow-up) I have squashed the both follow-up patches. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9161 Frédéric Demians <frederic@tamil.fr> 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=9161 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chris@bigballofwax.co.nz -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9161 --- Comment #8 from Chris Cormack <chris@bigballofwax.co.nz> --- Created attachment 18362 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=18362&action=edit Bug 9161: Translate only specific files The previous version of tmpl_process3.pl says in the pod: -i, --input=SOURCE Get or update strings from SOURCE file. SOURCE is a directory if -r is also specified. But is was not possible to specify one or more files. This patch allows us to give one or more specific file with the -f parameter. for eg.: perl tmpl_process3.pl install -i /home/koha/koha-tmpl/opac-tmpl/prog/en/modules/ -o /home/koha/koha-tmpl/opac-tmpl/prog/fr-FR/modules/ -s /home/koha/misc/translator/po/fr-FR-i-opac-t-prog-v-3006000.po -r -f opac-account.tt -f opac-main.tt You can specify: -f advsearch.tt => translate all files with a filename containing 'advsearch.tt' or -f search => will translate acqui/histsearch.tt, acqui/z3950_search.tt, etc. Bug 9161: Followup: Add a -f param for the translate script Now you can directly call the translate script (misc/translator/translate) with the -f parameter eg.: ./translate install|create|update -f search.tt -f main.tt Signed-off-by: Frédéric Demians <f.demians@tamil.fr> I've squashed the 3 patches, and reported doc into 'translate' script. It works as advertised. Side note: It would be great to extend this functionnality in order to be able to apply the translation to XSL files stored outside Koha directories hierarchy. Useful to translate site-specific XSLs defined with XSLTResultsDisplay, and other sysprefs. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9161 --- Comment #9 from Chris Cormack <chris@bigballofwax.co.nz> --- Created attachment 18363 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=18363&action=edit Bug 9161: Followup: the -f param does not work correctly Without this patch, the -f param (for the translate script) add the modified line in the po file BUT comment all lines from others files. This patch concat the generated file with the previous one and merge them. This way produce a pretty po file with all our strings :) + Modification in LangInstaller.pm to fix a bug when the -f param was not given. Test plan: 1/ Update your po file : cd misc/translator perl translate update fr-FR git commit -a -m"TMP PO" 2/ Modification on 2 files: ie. catalogue/advsearch.tt:32 <h1>Advanced search Foo</h1> catalogue/issuehistory.tt:38 <th>Patron Bar</th> 3/ Update your po file with only the first file: perl translate update fr-FR -f advsearch.tt 4/ Edit your po file and check that only the foo string is present (or git diff). 5/ Update your po file with only the second file: perl translate update fr-FR -f issuehistory 6/ Edit your po file and check that 2 strings are present (or git diff). 7/ Change the translation for these 2 strings and delete the fuzzy lines. 8/ Install the first file for your language: perl translate install fr-FR -f advsearch.tt 9/ Edit your translated file and verify the string is translated. Check that the issuehistory.tt file is not changed. 10/ Same for issuehistory: perl translate install fr-FR -f issuehistory 11/ stash your modification in your tt files (or reset --hard): git stash 12/ Check in your po file that the 2 strings are commented (git diff). 13/ To finish, install all template files and check that they are replaced correctly: perl translate install fr-FR Signed-off-by: Frédéric Demians <f.demians@tamil.fr> I have squashed the both follow-up patches. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9161 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #14208|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9161 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #15207|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9161 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #10 from Chris Cormack <chris@bigballofwax.co.nz> --- Passes all tests, and works as advertised without breaking existing functionality. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9161 Galen Charlton <gmcharlt@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |gmcharlt@gmail.com --- Comment #11 from Galen Charlton <gmcharlt@gmail.com> --- Pushed to master. Thanks, Jonathan! -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org