Bug#974922: libapache2-mod-perl2: "mod_perl interferes with mod_php locales, unable to use gettext translations"

Claudio Kuenzler ck at claudiokuenzler.com
Wed Nov 18 08:02:42 GMT 2020


Hi Damyan,

Thanks for your follow-up!


> It would be nice if you could share the translate.php contents (or
> a minimal version) so that the issue can be reproduced and any
> prospective fixes/workarounds be tested.
>

As a matter of fact, I was right in the middle of reproducing this on
another Debian 10 machine. It can be reproduced easily.

Just use a standard Apache installation with libapache2-mod-php7.3, place
the translate.php in the document root and create the locale structure in
the same path as translate.php: ./locale/de_CH.UTF-8/LC_MESSAGES/
Inside LC_MESSAGES place a homepage.po file, here's an example:

------- cut -------
# Sample translation.
# Copyright (C) 2020 Infiniroot.
# Infiniroot LLC <redacted at example.com>, 2020.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Infiniroot 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-16 10:00+0100\n"
"PO-Revision-Date: 2020-11-16 10:00+0100\n"
"Last-Translator: Infiniroot <redacted at example.com>\n"
"Language-Team: Infiniroot <redacted at example.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

# Home page
msgid "Dedicated Hosting Description"
msgstr "Mein deutscher Text"
------- cut -------

Then use msgfmt command (from the gettext package) to create a binary mo
file:

cd locale/de_CH.UTF-8/LC_MESSAGES/; msgfmt homepage.po
--output-file=homepage.mo -v

When you now launch the translate.php file through Apache (you can use
curl), it should translate and show the German translation.

$ curl localhost/translate.php
Mein deutscher Text

Then install and enable the libapache2-mod-perl2 module and restart Apache.
The translation stops working.

$ curl localhost/translate.php
Original English was returned. Something wrong

I published a blog article about this behaviour yesterday:
https://www.claudiokuenzler.com/blog/1023/php-gettext-translations-not-working-apache-mod_php-cli-works.
The sample translate.php is included in the article.

Hope this helps. Am available for debugging this together if you want.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-perl-maintainers/attachments/20201118/072be0ce/attachment.html>


More information about the pkg-perl-maintainers mailing list