Using POEdit — only search for strings in specific domain

前端 未结 2 1839
一个人的身影
一个人的身影 2021-01-12 11:47

I have created a WordPress theme that I wish to translate.

Inside my theme I use some translations from woocommerce (i.e.

2条回答
  •  被撕碎了的回忆
    2021-01-12 12:25

    Neither GNU gettext tools nor Poedit (which uses them) support this particular misuse of gettext.

    In gettext, domain is roughly “a piece of software” — a program, a library, a plugin, a theme. As such, it typically resides in a single directory tree and is alone there — or at the very least, if you have multiple pieces=domains, you have them organized sanely into some subdirectories that you can limit the extraction to.

    Mixing and matching domains within a single file as you do is not how gettext was intended to be used, and there’s no reasonable solution to handle it other than using your own helper function, e.g. by wrapping all woocommerce texts into __woo (which you must define, obviously) and not adding that to the list of keywords in Poedit.

提交回复
热议问题