douqian4411 2015-05-24 10:03
浏览 77

使用POEdit - 仅搜索特定域中的字符串

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

Inside my theme I use some translations from woocommerce (i.e. <?php _('Your cart', 'woocommerce'); ?>).

Theese woocommerce strings, I do not wish to translate again, naturally, as they are already translated. But when I use poedit to scan my theme, of course it will find ALL text domains.

So my question is:

How can I tell POEdit to only pick up only strings in a specific text domain?

  • __('Something', 'my-text-domain')
  • _e('Something else', 'my-text-domain')

I have found this answer:

However it does not seem to work for me. I have added ri:1,3c to the list as described, but it doesn't change anything, and I have no other clue as to what to do with it.

See how I did it:

poedit sources keywords

  • 写回答

2条回答 默认 最新

  • dplp5928 2015-05-24 16:34
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图