When installing a language that has already been installed before you'll end up with this error: fr-FR installer dir /kohadevbox/koha/installer/data/mysql/fr-FR already exists. This is a problem, as the files in the directory won't be replaced with their updated versions or files will be missing: Hadn't been installed before: kohadev-koha@kohadevbox:/kohadevbox/koha/misc/translator$ ls -l ../../installer/data/mysql/es-ES total 12 drwxr-xr-x 2 kohadev-koha kohadev-koha 4096 Nov 28 20:25 mandatory drwxr-xr-x 4 kohadev-koha kohadev-koha 4096 Nov 28 20:25 marcflavour drwxr-xr-x 2 kohadev-koha kohadev-koha 4096 Nov 28 20:25 optional Had been installed before: kohadev-koha@kohadevbox:/kohadevbox/koha/misc/translator$ ls -l ../../installer/data/mysql/fr-FR/ total 0 There have been reports on problems with installing/updating languages on the mailing list and IRC: https://lists.katipo.co.nz/pipermail/koha/2022-November/058691.html https://lists.koha-community.org/pipermail/koha-devel/2022-November/047398.html http://irc.koha-community.org/koha/2022-11-28#i_2464321 Something is not going well here. Another thing: The start page looks ok for es-ES but appears broken for de-DE in my test. Still investigating, but also wondering if it's another file related issue.
How to recreate the problem? I've run twice translate install fr-FR and don't see the error.
I think it should be visible when you run the commands koha-translate --update language and the language is already installled. It also appeared for me when I used the old way: kshell, cd misc/translator, perl translate install de-DE. I always had the message.
On IRC I also talked to Tylathos in PM and he showed me the same error message on his package installation.
I think there are several things here. The de-DE interface is broken because of "% l: Unknown or unsupported format specification" To get the origin of the error: % junitmsgfmt misc/translator/po/de-DE* <failure message="msgfmt failure">misc/translator/po/de-DE-staff-prog.po:12520: 'msgstr' is not a valid C format string, unlike 'msgid'. Reason: The character that terminates the directive number 2 is not a valid conversion specifier. misc/translator/po/de-DE-staff-prog.po:66878: 'msgstr' is not a valid C format string, unlike 'msgid'. Reason: The string ends in the middle of a directive. msgfmt: found 2 fatal errors 12519 msgid "Are you sure you want to delete \"%s\"?" 12520 msgstr "Sind Sie sicher, dass Sie \"%s% löschen möchten?"
(In reply to Jonathan Druart from comment #4) > I think there are several things here. > > The de-DE interface is broken because of "% l: Unknown or unsupported format > specification" > > To get the origin of the error: > % junitmsgfmt misc/translator/po/de-DE* > > <failure message="msgfmt > failure">misc/translator/po/de-DE-staff-prog.po:12520: 'msgstr' is not a > valid C format string, unlike 'msgid'. Reason: The character that terminates > the directive number 2 is not a valid conversion specifier. > misc/translator/po/de-DE-staff-prog.po:66878: 'msgstr' is not a valid C > format string, unlike 'msgid'. Reason: The string ends in the middle of a > directive. > msgfmt: found 2 fatal errors > > > 12519 msgid "Are you sure you want to delete \"%s\"?" > 12520 msgstr "Sind Sie sicher, dass Sie \"%s% löschen möchten?" Yes, I already fixed these. But I also had display problems with other installed languages. It was fr-FR - maybe also some errors there. Let's keep the display issue separate from the files not being updated in the installer directory.
> https://lists.katipo.co.nz/pipermail/koha/2022-November/058691.html Aleisha, did you manage to recreate the problem in ktd?
Created attachment 144311 [details] [review] Bug 32356: Install installer translated files on update If the installer files exist for a given language, the translate script won't update it. We should get a confirmation from Bernardo (author of bug 24262), but I don't understand why it could be needed (side-effects?) Test plan: Installer several times the same language, drop the DB and run the installer+onboarding process. Check files installed by the installer (yaml for notice templates, biblio frameworks) have inserted the data properly in DB.
This patch might fix Michael's problem, but it shouldn't fix Aleisha's.
Created attachment 144418 [details] [review] Bug 32356: Install installer translated files on update If the installer files exist for a given language, the translate script won't update it. We should get a confirmation from Bernardo (author of bug 24262), but I don't understand why it could be needed (side-effects?) Test plan: Installer several times the same language, drop the DB and run the installer+onboarding process. Check files installed by the installer (yaml for notice templates, biblio frameworks) have inserted the data properly in DB. Signed-off-by: Katrin <katrin.fischer.83@web.de>
Created attachment 144422 [details] [review] Bug 32356: Install installer translated files on update If the installer files exist for a given language, the translate script won't update it. We should get a confirmation from Bernardo (author of bug 24262), but I don't understand why it could be needed (side-effects?) Test plan: Installer several times the same language, drop the DB and run the installer+onboarding process. Check files installed by the installer (yaml for notice templates, biblio frameworks) have inserted the data properly in DB. Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Isn't this a permissions problem because people are using koha-translate as root?
koha-translate --update removes the translated templates before re-generating: 136 if print_installed | grep -q $lang; then 137 # Check po files are present 138 check_lang_po_files $lang 139 remove_lang $lang 140 install_lang $lang
(In reply to Tomás Cohen Arazi from comment #12) > koha-translate --update removes the translated templates before > re-generating: > > 136 if print_installed | grep -q $lang; then > 137 # Check po files are present > 138 check_lang_po_files $lang > 139 remove_lang $lang > 140 install_lang $lang I cannot remember, maybe this patch fixes the problem if you are not using koha-translate? It's not consistent to skip installer if the lang directory exist, and not doing it in other LangInstaller::install_* subroutines (install_prefs, install_tmpl, install_messages) anyway.
(In reply to Tomás Cohen Arazi from comment #11) > Isn't this a permissions problem because people are using koha-translate as > root? I did run misc/translate/translator with root until now without problems.. Being lazy, and note my container root actually is quite limited.
Here is a dumb question but couldnt we add TESTS for this module too ? Interesting that we have misc/translator/translate and debian/scripts/koha-translate. Shouldnt the latter one only be a very thin wrapper around the first one? Currently, it is a bit more. It implements an update option that we are missing in LangInstaller although the POD claims that it is present (but proposing something else): =head2 update For the current language, update .po files. sub install_installer => Nothng better than choosing a good subroutine name :) sub install_messages mkdir "$progdir/$self->{lang}/js"; => No check here ? Reading the comments, I think that we still need feedback from a few people (Bernardo, Aleisha, maybe others). And it feels like only removing the -d code is a bit of trial and error. This area of Koha (also) needs a bit more attention than that?
(In reply to Tomás Cohen Arazi from comment #12) > koha-translate --update removes the translated templates before > re-generating: > > 136 if print_installed | grep -q $lang; then > 137 # Check po files are present > 138 check_lang_po_files $lang > 139 remove_lang $lang > 140 install_lang $lang This diddn't work for me.
We need to decide which problem is the one we are solving here. And I don't think `koha-translate` should be used on KTD or a packages install. Just plain `perl translate...` Different scenarios seem to be mixed in the conversation. Regarding running as root vs. not doing so, it is clear to me that if you use the root user for all the things related to the repo (branches, new files as generated by perl translate, etc) you won't see any problems. If you work outside the container with your regular user, on the repo, then you will notice git repo problems (e.g. 'fatal: detected dubious ownership in repository').
For the record: root@kohadevbox:kohadevbox$ kshell kohadev-koha@kohadevbox:/kohadevbox/koha$ cd misc/translator/ kohadev-koha@kohadevbox:/kohadevbox/koha/misc/translator$ perl translate install fr-FR kohadev-koha@kohadevbox:/kohadevbox/koha/misc/translator$ perl translate install fr-FR kohadev-koha@kohadevbox:/kohadevbox/koha/misc/translator$ perl translate install fr-FR kohadev-koha@kohadevbox:/kohadevbox/koha/misc/translator$
What about the --dev option for koha-translate?
I really don't understand why this has not been pushed already. (In reply to Jonathan Druart from comment #13) > It's not consistent to skip installer if the lang directory exist, and not > doing it in other LangInstaller::install_* subroutines (install_prefs, > install_tmpl, install_messages) anyway. It's obvious what's happening here, the files are not updated when they exist already, we skip the "installer" task! To recreate: - fr-FR and es-ES not installed % perl translate install fr-FR % grep -r Maybe ../../installer/data/mysql/fr-FR/ => There is not occurrence of "Maybe" in fr-FR! # Add it: % vim $SYNC_REPO/installer/data/mysql/en/mandatory/auth_values.yml Add a new entry 38 - category: "YES_NO" 39 authorised_value: "1" 40 lib: "Maybe" 41 lib_opac: "Maybe" % perl translate install es-ES % grep -r Maybe ../../installer/data/mysql/es-ES ../../installer/data/mysql/es-ES/mandatory/auth_values.yml: lib: Maybe ../../installer/data/mysql/es-ES/mandatory/auth_values.yml: lib_opac: Maybe => OK! % perl translate install fr-FR % grep -r Maybe ../../installer/data/mysql/fr-FR/ => KO, It's not updated!
(In reply to Jonathan Druart from comment #20) > I really don't understand why this has not been pushed already. I think it is because of the confusion on the report and what's being actually fixed. - file already exists error (which my last post highlights I wasn't able to reproduce) - no, it was koha-translate (which deletes before re-generating, so that's not a real issue) - asking for a --dev option for koha-translate (maybe but that's another feature, I guess?)
Created attachment 146426 [details] [review] Bug 32356: Install installer translated files on update If the installer files exist for a given language, the translate script won't update it. We should get a confirmation from Bernardo (author of bug 24262), but I don't understand why it could be needed (side-effects?) Test plan: Installer several times the same language, drop the DB and run the installer+onboarding process. Check files installed by the installer (yaml for notice templates, biblio frameworks) have inserted the data properly in DB. Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Pushed to master for 23.05. Nice work everyone, thanks!
Nice work, thanks everyone! Pushed to 22.11.x for the next release.
Backported to 22.05.x for upcoming 22.05.10
applied to 21.11.x for 21.11.18
Not backported to 21.05.x