(This is the answer of my answer to the same here .)
Neither the GNU gettext tools nor the Poedit (which uses them) support this misuse of gettext.
In gettext, a domain is roughly a “piece of software” —a program, library, plugin, theme. Thus, it is usually located in one directory tree and is located there alone - or at least if you have several pieces = domains, you can organize them in some subdirectories that you can limit to extraction.
Mixing and matching domains in the same file, just like you, is not how gettext should have been used, and there is no reasonable solution to handle it except using your own helper function, for example. wrapping all myDomain texts in __mydomain (which you should define, obviously) and adding this to the keyword list in Poedit when retrieving for myDomain and not adding it to the keyword list for files of other domains.
source share