There's no way it could know what the post_type value could be at runtime and so it couldn't possibly know what to write into the created PO file. $this->post_type is not a literal, which is why xgettext doesn't recognize it. The text has to be a string literal for xgettext to extract it and so does the context (it has to be: it's something that goes into the PO file!). The important part is that it is handled the same way as the text to be translated. "Open" that could be used in different context, so the programmer would use e.g. The codex page above has an example another one is e.g. See the documentation for _x() at - the second argument is context, which is a string included in the PO together with the source text to disambiguate otherwise identical strings with different meaning. Is there something I'm doing wrong, or have I encountered an actual bug? Would have thought that the "_x:1,2c " bit would be enough to pick up the string, but it never does.
POEDIT 2 UPDATE
But as it is written, the "Add New" string simply wont show in PoEdit.Įven if I add manually the string to the po file, it will put it in the "obsolete strings" after trying to update to. And if I change _x to _ (and remove the context parameter) it picks that one as well. I know that Poedit is scanning that file (all the other translatable strings are picked up on "update catalog", and share the same domain). "esc_attr_ esc_attr_e esc_attr_x:1,2c esc_html_ esc_html_e esc_html_x:1,2cn"Īnd my php/wordpress code contains: _x( 'Add New', $this->post_type, $domain ),
po file contains: "X-Poedit-KeywordsList: _ _e _ngettext:1,2 _n:1,2 _ngettext_noop:1,2 "