#42747 closed enhancement (wontfix)
i18n: Add specific text domain processing to `makepot` tools
Reported by: | JPry | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | I18N | Keywords: | has-patch |
Focuses: | Cc: |
Description
In the tools/i18n/
directory of the core repo is a great set of tools. As a plugin developer, two of the most useful tools are the makepot.php
and add-textdomain.php
files.
As an enhancement, it would be nice if the makepot.php
file was able to operate on a specific text domain. This obviously wouldn't be necessary for Core, but for plugins and themes it could be quite useful. In particular, it would be great to have in the following cases:
- When including default WordPress strings in conjunction with custom strings.
- When including 3rd-party bundled libraries, such as CMB2.
- When trying to put together a single translation file that spans multiple plugins and even a theme in a single site (this is certainly an edge case, but I have worked with clients who have this need)
I have a working patch that allows passing a textdomain and processing that domain only.
I opened this ticket as the result of a discussion in Slack.
Attachments (1)
Change History (7)
#3
follow-up:
↓ 4
@
7 years ago
I'd just like to point out that I raised #41551 to officially support use of null for text domain name parameter.
My solution for shared libraries currently relies on the fact that makepot doesn't actually care what text domain you specify in your source. Shared library files use a text domain of null. I've implemented Just Translate It to merge translations into the null domain.
I hope your patch allows me to continue to extract strings regardless of the text domain.
#4
in reply to:
↑ 3
@
7 years ago
Replying to bobbingwide:
I hope your patch allows me to continue to extract strings regardless of the text domain.
This shouldn't break any current functionality, but I'd be grateful if you'd be willing to test my patch with your current workflow to see if it causes an issue.
With the attached patch, here's an example of extracting strings for the
example
textdomain:Omitting the path to the
.pot
file will create the file in the current directory.Note that this works nearly identically to the current
makepot.php
file, and that file should continue to function without any issues.