[wp-trac] [WordPress Trac] #41551: Officially support use of null for text domain name parameter to l10n functions

WordPress Trac noreply at wordpress.org
Thu Aug 3 16:45:55 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       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 I am working on some code which shares library files between plugins /
 themes. A plugin or theme that needs to use some particular logic is able
 to ''require'' a library then  assuming it's been loaded successfully,
 make use of the logic. Multiple plugins may deliver a library file but
 only one instance of a library file is loaded. Common logic implements
 version and dependency checking and therefore prevents run time fatal
 errors due to functions or classes being redefined.

 The solution works fine, but it poses some challenges with regards to
 localisation of any strings that are used in the shared library files.

 Having investigated a number of potential options I have concluded that a
 viable solution can be implemented by using some "Just Translate It" logic
 that is text domain agnostic.

 The simplest implementation depends on the use of a `null` value for the
 `$domain` parameter to functions such as `__()`.

 This TRAC requests that WordPress core officially sanctions this use of
 null.

 I have developed some unit tests that demonstrate that the current code
 works fine.

 I don't think it's necessary to change any of the docblocks in l10n.php

 If required I will furnish more documentation that explains the "Just
 Translate It" approach.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41551>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list