Changing the WordPress site language to any other than English slows down page generation times. A lot. This is caused by the slow and inefficient way of text domain loading. PO and MO files are designed to be used with PHP Gettext-extension. But since it’s an extension, it’s not installed by defalt on very hosting platform. To overcome this barrier, WordPress has re-implemented the whole MO file parsing in PHP, but WordPress’ implementation is quite slow and memory intense.
This plugin replaces the default MO-Reader with another implementation of MO parsing, which is faster than the default one. Only used text domains are loaded (since version 4.6 this is also WordPress’ default behaviour) and from these only used translations are loaded. It also makes use of hash tables included in mo files, which are ignored completely by WordPress’ default implementation. To boost the performance even more, the plugin also caches translations to the object cache, if one is installed. For optimal performance you need a fast object cache backend like Redis, Memcached or APC(u).
Fast Translate is a minimalistic fork of WP Performance Packs localization improvements. WP Performance Pack offers additional control and more optimizations for WordPress performance, e.g. use of PHPs native gettext extension, improved image handling and CDN support.
Requires PHP >= 5.3 and WordPress >= 4.0
- Download, install and activate. That’s it. No settings required.
- Which persisten object cache plugins are recommended?
Any persisten object cache will do, but it has to be supported in your hosting environment. Check if any caches like APC(u), XCache, Memcache, etc. are installed on your webserver and select a suitable cache plugin respectively. File based object caches should work always and might improve performance, same goes for data base based caches. Performance gains depend on the available caching method and its configuration.
- Does Fast Translate support multisite?
- How do localization improvements work
Fast Translate overrides WordPress’ default implementation by using the override_load_textdomain hook. It uses a complete rewrite of WordPress’ MO imlementation. The default WordPress implementaion loads a complete mo file whenever a single translation from it is needed. This needs quite some time and even more memory. Fast Translate features on demand loading. It doesn’t load a mo file until the first translation call to that specific textdomain (so does WordPress since version 4.6). And it doesn’t load the entire mo file either, only the requested translation. Though the (highly optimized) search for an individual translation is slower, the vastly improved loading time and reduced memory foot print result in an overall performance gain.
Caching can further improve performance. When using Fast Translate with an installed and activated object cache, translations get cached using WordPress Object Cache API. Front end pages usually don’t use many translations, so for all front end pages one cache is used per textdomain. Back end pages on the other hand use many translations. So back end pages get each their own individual translation cache with one base cache for each textdomain. This base cache consists of those translations that are used on all back end pages (i.e. they have been used up to admin_init hook). Later used translations are cached for each page. All this is to reduce cache size, which is very limited on many caching methods like APC. To even further reduce cache size, the transaltions get compressed before being saved to cache.
Nema recenzija za ovaj dodatak.
Suradnici i Programeri
“Fast Translate” je softver otvorenog koda. Sljedeće osobe su doprinijele ovom dodatku.Suradnici
- PHP <= 7.0 compatibility fix (thanks @no3x)
- Fixed plurals translation (thanks @wordpressserg)
- Some minor tweaks and fixes for PHP >= 7.2
- Futher performance improvements
- Added improvements by @mte90
First realease on wp.org