[wp-trac] [WordPress Trac] #58321: `_load_textdomain_just_in_time()` firing too often for en_US sites
WordPress Trac
noreply at wordpress.org
Mon May 29 08:34:59 UTC 2023
#58321: `_load_textdomain_just_in_time()` firing too often for en_US sites
--------------------------------------+--------------------------
Reporter: swissspidy | Owner: swissspidy
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 6.3
Component: I18N | Version: 6.2
Severity: normal | Resolution: fixed
Keywords: has-patch has-unit-tests | Focuses: performance
--------------------------------------+--------------------------
Changes (by swissspidy):
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"55865" 55865]:
{{{
#!CommitTicketReference repository="" revision="55865"
I18N: Improve `_load_textdomain_just_in_time()` logic when there are no
translation files.
Fixes a performance issue where the JIT logic is invoked for every
translation call if the there are no translations in the current locale.
With this change, the information is cached by adding `Noop_Translations`
instances to the global `$l10n` array. This way,
`get_translations_for_domain()` returns earlier, thus avoiding subsequent
`_load_textdomain_just_in_time()` calls.
Props swissspidy, johnbillion, ocean90.
Fixes #58321.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58321#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list