0
votes

The website is correctly translated using _("foo") to make POEdit translate them. The problem is that I have json_encode() method, that I use to show messages in a form.

I'm using it like this:

echo json_encode(array('info' => 'error', 'msg' => _("Message here")));`

And although POEdit does find the text, it does not translate.

Does someone know how I can translate these messages using POEdit, or any other way? Thanks.

1

1 Answers

0
votes

“Poedit” doesn’t translate things at runtime, your gettext library does. You need to initialize it and actually load the MO file with translations. Consult the documentation for whatever language/runtime this is (e.g. plain PHP and WordPress would do it differently).