[wp-trac] [WordPress Trac] #37997: Increase in function calls to get_locale() because of _load_textdomain_just_in_time()

WordPress Trac noreply at wordpress.org
Thu Sep 22 20:03:29 UTC 2016


#37997: Increase in function calls to get_locale() because of
_load_textdomain_just_in_time()
-------------------------------------------------+-------------------------
 Reporter:  sharkomatic                          |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  4.6.2
Component:  I18N                                 |     Version:  4.6
 Severity:  normal                               |  Resolution:
 Keywords:  needs-testing has-patch has-unit-    |     Focuses:
  tests                                          |  performance
-------------------------------------------------+-------------------------

Comment (by swissspidy):

 Replying to [comment:12 ocean90]:
 > Replying to [comment:11 swissspidy]:
 > > @ocean90 What do you think of the latest patch?
 >
 > Looks hackish. `unload_textdomain()` should only be used to unload
 existing text domains IMO.

 Yeah my first suggestion was to solve this another way as well.
 [attachment:37997.2.diff] resolves this by modifying
 `get_translations_for_domain()`. It also adds an actual test to ensure
 `get_locale()` is only called exactly once, even if there are 5 calls to
 `__()` or the lilke.

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


More information about the wp-trac mailing list