Created attachment 4366 [details] [review] inconsistence check for tmpl_process3.pl Missing '%s' in translated string could easily result to "Template process failed" (when [% END %] is missing for example). And in result, the end-user is blocked with an error. It would be advantageous to have a small check for inconsistence check between the number of '%s' in msgid and the number of '%s' in msgstr, at the install time. Note: on the 3.4.1, I have 217 string mismatched in staff.po... This check could be easily be added just after PO loading, in tmpl_process3.pl.
> This check could be easily be added just after PO loading, in > tmpl_process3.pl. I agree. Could your submit that as a git patch I can sign off. Thanks.
Created attachment 4373 [details] [review] git patch: check consistency of PO messages
Created attachment 4376 [details] [review] Proposed patch
I have modified your patch. Display a warning for strings that don't have the same count of %s placeholders that the English original strings. Don't warn for not translated string and 'fuzzy' string because those strings are not installed, and this is the translator responsibility to examine them. Please test this patch and sign it off. Thanks.
Created attachment 4378 [details] [review] Signed-off patch It works great (and better warnings for user). Thanks.
I applied the patch to an updated 3.4.x based branch, modified a working .po file to have inconsistent number of '%s' and run 'translate install es-ES', no warning was issued, script ended ok claiming: "The install seems to be successful." Was it not the proper way to test it?
When inconsistences are found, only warnings are issued, not a blocking error. So only messages are showed, and at the beginning of process: --- BEGIN extract of "translate install fr-FR" --- Install templates Install templates 'opac From: /srv/koha/koha-git-tree/koha-tmpl/opac-tmpl/prog/en/ To : /srv/koha/koha-git-tree/koha-tmpl/opac-tmpl/prog/fr-FR With: /srv/koha/koha-git-tree/misc/translator/po/fr-FR-i-opac-t-prog-v-3002000.po Charset in/out: UTF-8 at /srv/koha/koha-git-tree/misc/translator/tmpl_process3.pl line 268. tmpl_process3.pl: Warning: unconsistent %s count: (2/1): line: 7913 msgid: "Enter your User ID%s and password%s, and click the submit button (or press the enter key)." msgstr: "Entrez votre identifiant adhérent%s et mot de passe, puis cliquez sur le bouton \"Soumettre\" (ou appuyez sur la tou che <Entrée>)" tmpl_process3.pl: Warning: unconsistent %s count: (12/10): line: 12190 msgid: "The %s most checked-out %s %s %s titles%s %s at %s %s %s in the past %s months %s of all time%s " msgstr: "Les %s plus empruntés %s %s %s documents à %s %s %s dans les %s derniers mois %s depuis le commencement%s " tmpl_process3.pl: Warning: unconsistent %s count: (1/0): line: 10094 msgid: "Note: you can only delete your own tags. %sNote: your tag contained markup code that was removed. " msgstr: "Note : votre tag contenait du texte qui a été supprimé. " Copying /srv/koha/koha-git-tree/koha-tmpl/opac-tmpl/prog/en/css/sanop.css... Copying /srv/koha/koha-git-tree/koha-tmpl/opac-tmpl/prog/en/css/print.css... Copying /srv/koha/koha-git-tree/koha-tmpl/opac-tmpl/prog/en/css/colors.css... [...] The install seems to be successful. --- END --- Could you verify if warning are present between: "Charset in/out: ..." and "Copying ..." (or "Creating ...") ? In order to grab all output in a file (message and warnings), you could redirect stdout and stderr in a file, using: > ./translate install es-ES 2>&1 | tee ~/bug6464-output.txt
Pushed please test
Thanks