[wp-trac] [WordPress Trac] #58919: Add a hook to set_cached_mo_files() to allow flexible caching strategies for globbing *.mo files

WordPress Trac noreply at wordpress.org
Thu Aug 3 22:12:39 UTC 2023


#58919: Add a hook to set_cached_mo_files() to allow flexible caching strategies
for globbing *.mo files
-------------------------+-----------------------------
 Reporter:  mreishus     |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  I18N         |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+-----------------------------

Comment (by mreishus):

 Thank you for the feedback:

 1. I agree with aligning the filter name and its usage with existing core
 practices. Could you provide some guidance on a better-suited name and any
 changes in usage that would more closely follow core patterns?

 2. I like the idea of built-in caching with invalidation whenever
 translations get installed. Would the 'upgrader_process_complete' hook be
 the place for this? Also, I'm curious if we should include this in the
 current ticket's scope or create a separate one?

 3. Regarding get_available_languages, my exploration revealed fewer files
 in play for core translations compared to set_cached_mo_files(). The
 impact was less significant, but it might still warrant some attention.

 In the WordPress.com context, here's what I've found:

 * set_cached_mo_files() on ./wp-content/languages/plugins examines ~12000
 files and takes ~7-10ms.
 * get_available_languages() on ./wp-content/languages examines ~600 files
 and takes ~0.75-1ms.

 One note is the effectiveness of the caching system could play into the
 benefits realized here.

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


More information about the wp-trac mailing list