This PR adds a new way to load MO files. As in WordPress, all translations of a given file are loaded in memory. However they are stored in an array of strings rather than an array of Translation_Entry objects. Thus, the performance is improved both when reading the file (it's faster to store a string in an array rather than creating a Translation_Entry object) and when translating strings.
Although this new method is faster than the method used in WordPress, processing the complete file is still slower than the dynamic method in use in v1.0. It becomes very fast if we don't have to read and parse the translation file. That's why, by default, the method is activated only when an external object cache is available.
The method can be programmatically selected with the filter dynamo_file_loader.
The cache expiration limit is set to 12 hours by default and is programmatically filterable with the filter dynamo_cache_expire. In any case, the cache is cleaned at each update (WordPress, theme, plugins or language packs).
The cache is common to all sites for multisite.
As a side effect of this development, the check for file readabibility has been moved to the MO classes.
This PR adds a new way to load MO files. As in WordPress, all translations of a given file are loaded in memory. However they are stored in an array of strings rather than an array of
Translation_Entry
objects. Thus, the performance is improved both when reading the file (it's faster to store a string in an array rather than creating aTranslation_Entry
object) and when translating strings.Although this new method is faster than the method used in WordPress, processing the complete file is still slower than the dynamic method in use in v1.0. It becomes very fast if we don't have to read and parse the translation file. That's why, by default, the method is activated only when an external object cache is available.
The method can be programmatically selected with the filter
dynamo_file_loader
.The cache expiration limit is set to 12 hours by default and is programmatically filterable with the filter
dynamo_cache_expire
. In any case, the cache is cleaned at each update (WordPress, theme, plugins or language packs).The cache is common to all sites for multisite.
As a side effect of this development, the check for file readabibility has been moved to the MO classes.