Bug 25517 - Koha.mo not found on package installations / Translations not working
Summary: Koha.mo not found on package installations / Translations not working
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Julian Maurice
QA Contact: Testopia
URL:
Keywords:
Depends on: 21789
Blocks:
  Show dependency treegraph
 
Reported: 2020-05-15 16:07 UTC by Katrin Fischer
Modified: 2021-12-13 21:09 UTC (History)
7 users (show)

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


Attachments
Bug 25517: Look in all possible places for MO files (1.67 KB, patch)
2020-05-22 14:51 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 25517: Look in all possible places for MO files (1.72 KB, patch)
2020-05-22 19:14 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2020-05-15 16:07:41 UTC
Bug 22422 introduced this to the staff search results:
                                            [% tnx('{count} item', '{count} items', SEARCH_RESULT.items_count, {count = SEARCH_RESULT.items_count}) | html %][% IF ( SEARCH_RESULT.availablecount ) %], [% SEARCH_RESULT.availablecount | html %] available:[% ELSE %], None available[% END %]

But this doesn't appear to get applied, although the strings are translated in the po file.

Might also affect other versions, but I couldn't verify.
Comment 1 Katrin Fischer 2020-05-15 16:37:34 UTC
Ok, it does translate when I reinstall the language in my dev environment. I wonder if this could be related to the packages and the update process?

I know translations are automatically updated when you install a new package. Is there a reson why this would not work for the new messages file?
Comment 2 Katrin Fischer 2020-05-16 10:13:51 UTC
This is probably a WONTFIX because of the old version (we will still investigate a bit more and I will share if we find out something useful)

The problem we encountered is that after several updates via packages the strings still appeared untranslated, although po files were in place.
Comment 3 Katrin Fischer 2020-05-18 08:31:07 UTC
Hm, still seeing issues there on our package based installation. Still investigating and trying to get it to translate.

Note the changed dependency, this is related to bug 21789.
Comment 4 Katrin Fischer 2020-05-20 14:48:13 UTC
We finally found a solution:

Koha/I18N.pm looks for the Koha.mo in the wrong path for package based installations. It works fine on git, gitified etc. but not for an installatione done from packages.

We solved it for now by creating a symlink.
Comment 5 Katrin Fischer 2020-05-20 15:15:44 UTC
Needs to be confirmed for other versions than 18.11, but I18N.pm hasn't changed.
Comment 6 Martin Renvoize 2020-05-22 11:38:55 UTC
Alpha packages are currently building for 20.05.. let's verify if this is still a bug with those.
Comment 7 Katrin Fischer 2020-05-22 11:40:49 UTC
(In reply to Martin Renvoize from comment #6)
> Alpha packages are currently building for 20.05.. let's verify if this is
> still a bug with those.

Thank you!
Comment 8 Jonathan Druart 2020-05-22 13:44:19 UTC
sub _base_directory {
    return C4::Context->config('intranetdir') . '/misc/translator/po';
}

but
debian/templates/koha-conf-site.xml.in: <intranetdir>/usr/share/koha/intranet/cgi-bin</intranetdir>

And POs are in /usr/share/koha/misc/translator/po
Comment 9 Katrin Fischer 2020-05-22 14:15:55 UTC
Thx Joubu, that's exactly the problem we've seen. Now hoping it can be fixed.
Comment 10 Julian Maurice 2020-05-22 14:51:13 UTC
Created attachment 105270 [details] [review]
Bug 25517: Look in all possible places for MO files

On a 'dev' install, MO files will be installed in
<intranetdir>/misc/translator/po
On 'standard' and 'single' installs, they will be installed in
<intranetdir>/../../misc/translator/po

This patch makes Koha::I18N try to use the "dev" directory first, and
fallback to the "standard" directory.
If none of these directories exist, it dies.
Comment 11 Katrin Fischer 2020-05-22 19:13:43 UTC
This might be more of a quick fix as noted in the FIXME. But given we are a bit short of time to the release we might want to consider it. I am doing a regression test as I can't test on a package installation myself, so take the sign-off with that grain of salt!
Comment 12 Katrin Fischer 2020-05-22 19:14:19 UTC
Created attachment 105276 [details] [review]
Bug 25517: Look in all possible places for MO files

On a 'dev' install, MO files will be installed in
<intranetdir>/misc/translator/po
On 'standard' and 'single' installs, they will be installed in
<intranetdir>/../../misc/translator/po

This patch makes Koha::I18N try to use the "dev" directory first, and
fallback to the "standard" directory.
If none of these directories exist, it dies.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 13 Martin Renvoize 2020-05-23 07:30:13 UTC
Passing QA.. local testing proved fruitful.  Thanks for the quick fix.. lets see if there's a nicer way as part of the next cycle.
Comment 14 Martin Renvoize 2020-05-23 07:31:38 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 15 Aleisha Amohia 2020-06-14 21:15:24 UTC
backported to 19.11.x for 19.11.07
Comment 16 Victor Grousset/tuxayo 2020-06-18 15:19:55 UTC
Backported to 19.05.x branch for 19.05.12