[wp-trac] [WordPress Trac] #34114: Remove the requirement to call load_plugin_textdomain() or load_theme_textdomain()
    WordPress Trac 
    noreply at wordpress.org
       
    Sun Jan  3 15:55:51 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:  Future
Component:  I18N                                 |  Release
 Severity:  normal                               |     Version:
 Keywords:  dev-feedback has-patch has-unit-     |  Resolution:
  tests                                          |     Focuses:
-------------------------------------------------+-------------------------
Comment (by swissspidy):
 Thanks for the quick feedback! It led me to another round of testing.
 It's clear that using `load_plugin_textdomain()` and
 `load_theme_textdomain()` isn't the solution. I like the idea of caching
 the list of translation files, so in [attachment:34114.2.diff] I added a
 `load_textdomain_just_in_time()` function that does this the first time
 it's called (using `get_available_languages()`).
 I haven't done any in-depth testing, but this method is definitely faster.
 Presumably even better than having every plugin call
 `load_plugin_textdomain()`.
 Some notes:
 * Defining `WP_LANG_DIR` as `DIR_TESTDATA . '/languages'` would help
 simplifying and extending the tests. Copying files just feels so wrong.
 See https://wordpress.slack.com/archives/core/p1435764072001069 (ping
 @ocean90)
 * Should #34213 be a prerequisite?
 * What happens when a theme and a plugin have the same textdomain?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34114#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
    
    
More information about the wp-trac
mailing list