[wp-trac] [WordPress Trac] #41551: Officially support use of null for text domain name parameter to l10n functions
WordPress Trac
noreply at wordpress.org
Fri Aug 4 06:58:15 UTC 2017
#41551: Officially support use of null for text domain name parameter to l10n
functions
-------------------------+------------------------------
Reporter: bobbingwide | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: I18N | Version: trunk
Severity: normal | Resolution:
Keywords: | Focuses:
-------------------------+------------------------------
Comment (by bobbingwide):
For the reasoning behind "Just Translate It "see
https://github.com/bobbingwide/oik-libs/issues/7#issuecomment-320028566
Replying to [comment:1 swissspidy]:
> Note that internationalization is just one aspect of the whole picture.
The strings need to be translated somewhere. When you're using a library
that's shared by 2 plugins, where on translate.wordpress.org is that
library going to be translated?
Since each plugin will contain the source files, makepot will find the
strings. The translations will then become available in the plugin's text
domain. The "Just Translate It" logic will merge the available
translations into the null domain so a translation will be found if one
has been supplied.
> It's currently a recommendation/rule that plugins and themes only
contain 1 text domain that should also match the plugin/theme slug.
Yes I know. But it's not enforced. Not all plugins / themes are on
wordpress.org.
> That's why libraries like TGMPA suggest passing the needed strings to
them, so that the library itself doesn't contain any. See
https://github.com/TGMPA/TGM-Plugin-
Activation/blob/189ed5d6a2767f554135cc9041e6f4927b396dd9/example.php#L135-L210.
Another duplication of translator's effort. And it means the calling
routine has to be fairly well aware of the library's implementation.
> Regarding [attachment:41551.diff], it basically treats `null` like any
other valid text domain, which looks kinda weird and unexpected, and could
lead to some serious troubles. Why `null`? It could just as well be any
other random string, no?
Yes, it could be any other random string. Null is the simplest form.
Once the null text domain has been built, then the translations will be
found by existing translate() logic.
If I used a whole suite of different text domains, one for each library,
then I'd need to use a different solution for determining when "Just
Translate It" logic is required. The code gets a lot messier.
The purpose of this TRAC is to formally request that WordPress core
recognises and supports the use of null.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41551#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list