Voting

: three plus zero?
(Example: nine)

The Note You're Voting On

kingjackal at gmail dot com
7 years ago
If your PO/MO files make use of msgctxt (Context), you'll be frustrated to find that gettext(msgid) won't work as you might expect (even if msgid is unique).

In this case, you must use ASCII char 4 [EOT, End Of Text] glued between the msgctxt and msgid.

Example PO content:

msgctxt "Context"
msgid "Test string"
msgstr "Test translation"

msgid "Standard string"
msgstr "Standard translation"

The following will work:

<?php
gettext
('Context' . "\004" . 'Test string');
gettext('Standard string');
?>

The following will NOT work:

<?php
gettext
('Test string');
?>

<< Back to user notes page

To Top