Bug 21895 - Translations fail on upgrade to 18.11.00 (package installation)
Summary: Translations fail on upgrade to 18.11.00 (package installation)
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: Main
Hardware: All All
: P5 - low blocker (vote)
Assignee: Julian Maurice
QA Contact: Testopia
URL:
Keywords:
: 21894 (view as bug list)
Depends on: 15395
Blocks:
  Show dependency treegraph
 
Reported: 2018-11-27 20:40 UTC by Mirko Tietgen
Modified: 2020-01-06 20:15 UTC (History)
10 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 21895: Fix translation for package install (8.18 KB, patch)
2018-11-27 23:53 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 21895: Fix path to POT file (1.00 KB, patch)
2018-11-28 09:06 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 21895: Fix translation for package install (8.23 KB, patch)
2018-11-28 10:43 UTC, Mirko Tietgen
Details | Diff | Splinter Review
Bug 21895: Fix path to POT file (1.06 KB, patch)
2018-11-28 10:44 UTC, Mirko Tietgen
Details | Diff | Splinter Review
Bug 21895: Fix translation for package install (8.29 KB, patch)
2018-11-28 11:51 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21895: Fix path to POT file (1.12 KB, patch)
2018-11-28 11:51 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Mirko Tietgen 2018-11-27 20:40:54 UTC
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)
Comment 1 Mirko Tietgen 2018-11-27 20:44:08 UTC
*** Bug 21894 has been marked as a duplicate of this bug. ***
Comment 2 Julian Maurice 2018-11-27 23:53:06 UTC
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
Comment 3 Mirko Tietgen 2018-11-28 08:44:55 UTC
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.
Comment 4 Julian Maurice 2018-11-28 09:06:02 UTC
Created attachment 82693 [details] [review]
Bug 21895: Fix path to POT file
Comment 5 Julian Maurice 2018-11-28 09:10:03 UTC
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 ?
Comment 6 Mirko Tietgen 2018-11-28 09:30:35 UTC
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?
Comment 7 Julian Maurice 2018-11-28 09:41:42 UTC
(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
Comment 8 Julian Maurice 2018-11-28 09:46:02 UTC
> `./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
Comment 9 Mirko Tietgen 2018-11-28 10:00:20 UTC
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?
Comment 10 Mirko Tietgen 2018-11-28 10:09:44 UTC
(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.
Comment 11 Julian Maurice 2018-11-28 10:16:39 UTC
(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.
Comment 12 Mirko Tietgen 2018-11-28 10:43:40 UTC
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>
Comment 13 Mirko Tietgen 2018-11-28 10:44:58 UTC
Created attachment 82696 [details] [review]
Bug 21895: Fix path to POT file

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Comment 14 Mirko Tietgen 2018-11-28 10:46:46 UTC
I built a package and verified it's working. I have not worked through the whole old test plan.
Comment 15 Mirko Tietgen 2018-11-28 10:49:45 UTC
(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.
Comment 16 Martin Renvoize 2018-11-28 11:51:06 UTC
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>
Comment 17 Martin Renvoize 2018-11-28 11:51:10 UTC
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>
Comment 18 Martin Renvoize 2018-11-28 11:54:45 UTC
Works well for me and I can't see any regressions.

I followed the full test plan and it all passed.

Passing QA
Comment 19 Nick Clemens 2018-11-29 19:15:37 UTC
Awesome work everyone!

Pushed to master for 19.05
Comment 20 Martin Renvoize 2018-12-10 09:31:13 UTC
Pushed to 18.11.x for 18.11.01
Comment 21 Lucas Gass 2018-12-14 17:25:22 UTC
depends on 15395 wont backport to 18.05