[wp-trac] [WordPress Trac] #39639: Increase cache time on wp_get_available_translations()
WordPress Trac
noreply at wordpress.org
Thu Jan 19 15:02:47 UTC 2017
#39639: Increase cache time on wp_get_available_translations()
-------------------------+-----------------------------
Reporter: leewillis77 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: I18N | Version: trunk
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
Currently there's no nice way of retrieving a full list of supported
languages / locale codes from WordPress. The closest seems to be:
{{{
require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
$languages = wp_get_available_translations();
}}}
This calls the WordPress.org API to retrieve the list, making this
approach not wholly suitable outside of its original intended use during
WordPress install. The results are currently cached for 3 hours so it's
not that the API will be called every time this function is called,
however it seems that the 3 hours could be extended reasonably safely
without causing any detriment.
Patch attached that extends the cache time to 24hrs.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39639>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list