[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 11 23:50:59 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 has-unit- | Focuses:
tests | performance
-------------------------------------------------+-------------------------
Comment (by jrf):
@ocean90
> I'm not really a fan of static variables
Well, the alternatives would be a global variable (Yikes!) or a class
property, but that would require refactoring the text domain loading to a
class...
The refactoring to a class might actually be a much better way forward in
the long run, but is not really a feasibly option for now if this is to
make it into 4.7.
> The function needs probably some sort of a $reset argument to make it
testable and compatible with the new locale switching functions.
I see your point. In that case, I'd suggest splitting it into two
functions, one (internal use) which does the actually checking and one
which keeps track of the static and can reset it.
> @jrf Can you work on a patch?
I can work on a patch, but I have limited time at the moment. What
timeframe are you looking for ?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37997#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list