I'd like to use pgettext to specify the context of some strings to translate, I've found that you need to add it yourself in PHP, which is what I did following this post's instructions. I've changed it a little bit to make it work (the dcgettext
function call had some errors):
function pgettext($context, $msgid) {
$contextString = "{$context}\004{$msgid}";
$translation = dcgettext('messages', $contextString, 5);
if ($translation == $contextString) return $msgid;
else return $translation;
}
But this function doesn't seems to work, the text is not changing when I change the language.
What am I missing?