On upgrade of a package installation to 18.11.00, there are several errors related to translations. Use of uninitialized value $pref_name in concatenation (.) or string at /usr/share/koha/misc/translator/LangInstaller.pm line 196. Use of uninitialized value $pref_name in concatenation (.) or string at /usr/share/koha/misc/translator/LangInstaller.pm line 238. Can't stat /usr/share/koha/intranet/cgi-bin/koha-tmpl: No such file or directory at /usr/share/koha/misc/translator/LangInstaller.pm line 633. /usr/bin/msginit: error while opening "Koha.pot" for reading: No such file or directory /bin/sed: can't read /usr/share/koha/misc/translator/po/de-DE-messages.po: No such file or directory /usr/bin/msgfmt: error while opening "/usr/share/koha/misc/translator/po/de-DE-messages.po" for reading: No such file or directory Updated the de-DE translations. find: invalid expression; you have used a binary operator '-or' with nothing before it. W: APT had planned for dpkg to do more than it reported back (0 vs 4). Affected packages: koha-common:amd64 Bugs related are 15395 and 21823 /usr/share/koha/intranet/cgi-bin/koha-tmpl appears to be a dev path not working for regular installations (/usr/share/koha/misc/translator/LangInstaller.pm line 633.) New files are not created (Koha.pot, de-DE-messages.po)
*** Bug 21894 has been marked as a duplicate of this bug. ***
Created attachment 82687 [details] [review] Bug 21895: Fix translation for package install The string extraction process was not taking into account the fact that standard/package install have a completely different directory structure than the dev install This patch tries to keep the exact same behaviour for dev installs, while making it work for standard install by using opachtdocs, intrahtdocs, opacdir and intranetdir from $KOHA_CONF Test plan: 1. Follow test plan in https://gitlab.com/koha-community/Koha/commit/d708255c7a4d981c7c7bdd0644a75202ec43b297 2. Do a standard install and repeat step 1 on this new install 3. If you know how to build the Debian package, build it, install it and verify that koha-translate works as expected 4. prove t/LangInstaller.t
I built a package with this patch. On upgrade, I get the following: Use of uninitialized value $pref_name in concatenation (.) or string at /usr/share/koha/misc/translator/LangInstaller.pm line 197. Use of uninitialized value $pref_name in concatenation (.) or string at /usr/share/koha/misc/translator/LangInstaller.pm line 239. /usr/bin/msginit: error while opening "Koha.pot" for reading: No such file or directory /bin/sed: can't read /usr/share/koha/misc/translator/po/de-DE-messages.po: No such file or directory /usr/bin/msgfmt: error while opening "/usr/share/koha/misc/translator/po/de-DE-messages.po" for reading: No such file or directory Updated the de-DE translations. find: invalid expression; you have used a binary operator '-or' with nothing before it.
Created attachment 82693 [details] [review] Bug 21895: Fix path to POT file
Not sure if it will fix the problem. But if xgettext doesn't complain, it means the POT file was created, but at a different location. Is `translate` script run from a different directory than its own ?
When I manually update the translation, it seems to work ./translate update de-DE Use of uninitialized value $pref_name in concatenation (.) or string at /usr/share/koha/misc/translator/LangInstaller.pm line 197. Created /usr/share/koha/misc/translator/po/de-DE-messages.po. I don't get a file Koha.pot though. Is that expected? koha-translate for packages does 'update' by removing the translation files, then 'install'. Reading bug 15395 I was under the impression that install should work. Is translate update required to get the new files created?
(In reply to Mirko Tietgen from comment #6) > I don't get a file Koha.pot though. Is that expected? Yes. The pot file is deleted at the end. > koha-translate for packages does 'update' by removing the translation files, > then 'install'. Reading bug 15395 I was under the impression that install > should work. Is translate update required to get the new files created? No it's not required. `./translate install` creates the xx-XX-messages.po if it doesn't exist
> `./translate install` creates the xx-XX-messages.po if it doesn't exist In fact, those files should probably generated for all languages and then committed, even if empty. That will prevent `./translate install` to try to extract strings every time
Okay, with both patches applied it seems to work but gives some warnings. Can we do something about these? Use of uninitialized value $pref_name in concatenation (.) or string at /usr/share/koha/misc/translator/LangInstaller.pm line 197. Use of uninitialized value $pref_name in concatenation (.) or string at /usr/share/koha/misc/translator/LangInstaller.pm line 239. Created /usr/share/koha/misc/translator/po/de-DE-messages.po. Updated the de-DE translations. find: invalid expression; you have used a binary operator '-or' with nothing before it. (In reply to Julian Maurice from comment #8) > > `./translate install` creates the xx-XX-messages.po if it doesn't exist > In fact, those files should probably generated for all languages and then > committed, even if empty. That will prevent `./translate install` to try to > extract strings every time Created on the pootle server?
(In reply to Mirko Tietgen from comment #9) > find: invalid expression; you have used a binary operator '-or' with nothing > before it. This is not related to translations, I found the problem.
(In reply to Mirko Tietgen from comment #9) > Okay, with both patches applied it seems to work but gives some warnings. > Can we do something about these? > > Use of uninitialized value $pref_name in concatenation (.) or string at > /usr/share/koha/misc/translator/LangInstaller.pm line 197. > Use of uninitialized value $pref_name in concatenation (.) or string at > /usr/share/koha/misc/translator/LangInstaller.pm line 239. I've seen these warnings for some time now. Not sure how to fix them > (In reply to Julian Maurice from comment #8) > > > `./translate install` creates the xx-XX-messages.po if it doesn't exist > > In fact, those files should probably generated for all languages and then > > committed, even if empty. That will prevent `./translate install` to try to > > extract strings every time > > Created on the pootle server? IMO not necessary for now, since they will be empty.
Created attachment 82695 [details] [review] Bug 21895: Fix translation for package install The string extraction process was not taking into account the fact that standard/package install have a completely different directory structure than the dev install This patch tries to keep the exact same behaviour for dev installs, while making it work for standard install by using opachtdocs, intrahtdocs, opacdir and intranetdir from $KOHA_CONF Test plan: 1. Follow test plan in https://gitlab.com/koha-community/Koha/commit/d708255c7a4d981c7c7bdd0644a75202ec43b297 2. Do a standard install and repeat step 1 on this new install 3. If you know how to build the Debian package, build it, install it and verify that koha-translate works as expected 4. prove t/LangInstaller.t Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Created attachment 82696 [details] [review] Bug 21895: Fix path to POT file Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
I built a package and verified it's working. I have not worked through the whole old test plan.
(In reply to Mirko Tietgen from comment #10) > (In reply to Mirko Tietgen from comment #9) > > > find: invalid expression; you have used a binary operator '-or' with nothing > > before it. > > This is not related to translations, I found the problem. I have added a string patch on bug 21897. (In reply to Julian Maurice from comment #11) > > Use of uninitialized value $pref_name in concatenation (.) or string at > > /usr/share/koha/misc/translator/LangInstaller.pm line 197. > > Use of uninitialized value $pref_name in concatenation (.) or string at > > /usr/share/koha/misc/translator/LangInstaller.pm line 239. > I've seen these warnings for some time now. Not sure how to fix them I think we can live with that. The find error looked more troublesome to me.
Created attachment 82697 [details] [review] Bug 21895: Fix translation for package install The string extraction process was not taking into account the fact that standard/package install have a completely different directory structure than the dev install This patch tries to keep the exact same behaviour for dev installs, while making it work for standard install by using opachtdocs, intrahtdocs, opacdir and intranetdir from $KOHA_CONF Test plan: 1. Follow test plan in https://gitlab.com/koha-community/Koha/commit/d708255c7a4d981c7c7bdd0644a75202ec43b297 2. Do a standard install and repeat step 1 on this new install 3. If you know how to build the Debian package, build it, install it and verify that koha-translate works as expected 4. prove t/LangInstaller.t Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 82698 [details] [review] Bug 21895: Fix path to POT file Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Works well for me and I can't see any regressions. I followed the full test plan and it all passed. Passing QA
Awesome work everyone! Pushed to master for 19.05
Pushed to 18.11.x for 18.11.01
depends on 15395 wont backport to 18.05