0
votes

I've got an issue with a Wordpress that I'm taking over now.

There is a .mo file containing some translations and a .po file that seems to be the source. The .po file seems have been generated somehow but its structure look a little weird to me.

Here is what can be found inside.

#: /Users/yui/Sites/fondation/wp-content/themes/fondation/taxonomy-programme.php:24
msgid "Exhibitions"
msgstr "Expositions"

#: /Users/yui/Sites/fondation/wp-content/themes/fondation/archive.php:69
#: /Users/yui/Sites/fondation/wp-content/themes/fondation/single.php:43
msgid "[:en]Events[:fr]Evénements[:de]Events[:pl]Events"
msgstr ""

When I try to generate the .mo file msgcat fondation-fr_FR.po | msgfmt -o fondation-fr_FR.mo - the .mo file contains only the first one (with both msgid and msgstr) but not the other one. The website also have an issue with that and display only the translation found in the .mo file.

Any thoughts on how to fix the .po file? Is it an old format?

2

2 Answers

0
votes

but its structure look a little weird to me.

Indeed. Looks like being done by somebody who had no idea how gettext works or that manuals are a thing and creatively abused gettext files (case in point: see the multiple translations in the msgid of all places).

The second string is not included in the compiled translations table (i.e. MO) because it has no translationmsgstr is empty.

BTW, everything about how gettext works, including how strings are retrieved and why it makes no sense to include untranslated entries in MO (hint: the string is already in the code!), is very well explained in the GNU gettext manual.

BTW2, that invocation of msgcat is also an entirely pointless busy work — see its man page for what it does (same as cat plus some smarts).

0
votes

For the records.

The .po file had been generated by an old version of qtranslate plugin for Wordpress which didn't know how to properly handle the gettext functions in its firsts versions.

Nothing could be done to get the .po file to work. I had to create a new one manually.