Contrary to the POD say, it is not possible to translate only one file. Very usefull for debug.
Created attachment 13728 [details] [review] 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
Created attachment 13729 [details] [review] 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.
Created attachment 13731 [details] [review] 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
Created attachment 14208 [details] [review] 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.
Created attachment 14914 [details] [review] 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
Created attachment 14997 [details] [review] 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.)
Created attachment 15207 [details] [review] Signed-off patch (merged follow-up) I have squashed the both follow-up patches.
Created attachment 18362 [details] [review] 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>
Created attachment 18363 [details] [review] 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>
Passes all tests, and works as advertised without breaking existing functionality.
Pushed to master. Thanks, Jonathan!