[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
Fri Nov 18 23:19:34 UTC 2016


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

Comment (by ocean90):

 [attachment:37997.3.diff] includes [attachment:trac-37997-v2-improve-just-
 in-time-performance.patch] and the test from [attachment:37997.2.diff]. In
 `_load_textdomain_just_in_time()` I've moved the
 `_get_path_to_translation()` call after the `$domain` and `$l10n_unloaded`
 checks.

 I also added `Tests_Locale_Switcher::test_something()` but this one is
 currently failing, with and without the patch. It looks like
 `WP_Locale_Switcher::load_translations()` is loading the .mo file for the
 previous locale again.

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


More information about the wp-trac mailing list