[wp-trac] [WordPress Trac] #34114: Remove the requirement to call load_plugin_textdomain() or load_theme_textdomain()

WordPress Trac noreply at wordpress.org
Thu Apr 28 18:59:49 UTC 2016


#34114: Remove the requirement to call load_plugin_textdomain() or
load_theme_textdomain()
--------------------------------------+------------------
 Reporter:  johnbillion               |       Owner:
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  4.6
Component:  I18N                      |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+------------------

Comment (by ocean90):

 @swissspidy Thanks. The array needs to be initialized, otherwise you'll
 get a PHP warning: `Warning: in_array() expects parameter 2 to be array,
 null given in /src/wp-includes/l10n.php on line 819`.

 In [attachment:34114.5.diff]:
 * Initialize `$cached_mofiles` as an array if it's null.
 * Short-circuit if domain is 'default' which is reserved for core.
 * Move tests to a new file `l10n/loadTextdomainJustInTime.php`.
 * In `get_translations_for_domain()` swap the order of the `isset()` check
 and `load_textdomain_just_in_time()`. No need to try loading the text
 domain again if it's already there.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34114#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list