[WordPress] 外掛分享: Dynamic MO Loader

首頁外掛目錄 › Dynamic MO Loader
10+
安裝啟用
尚無評分
2309 天前
最後更新
問題解決
WordPress 4.7.3+ PHP 7.0+ v1.4.1 上架:2019-07-29

內容簡介

將 WordPress 網站語言更改為非英文語言會大幅減慢頁面生成時間。這是由於執行載入文本域的方式緩慢且效率低下所造成的。這個外掛參考 Björn Ahrens 的優秀工作,旨在通過僅載入在頁面中使用的文本域,甚至通過對它們進行緩存來解決這個問題。
PO 和 MO 文件旨在與 PHP Gettext 擴展一起使用。但由於這是一個擴展,並非所有的主機平台都會預設安裝。為了克服這個障礙,WordPress 已經在 PHP 中重新實現了整個 MO 文件解析,完全忽略了使用本地 gettext 的可能性。這個 WordPress 的實現有點慢。
這個外掛有另一個更快的 MO 解析實現方式,比預設的還要快。此外,外掛還僅載入在當前頁面上生成所需的文本域,而不是預設行為中載入所有可用的文本域。由於前端頁面通常只使用少數文本域中的字串,因此這可以大大提高前端性能。
為了進一步提高性能,外掛還將載入的文本域緩存到了對象緩存中。為了獲得最佳性能,您需要一個快速的對象緩存後端,例如 Redis、Memcached 或 APC(u)。

連結

GitHub

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.4.1) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Dynamic MO Loader」→ 直接安裝(推薦)

原文外掛簡介

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. This plugin, based on the excellent work by Björn Ahrens, aims to fix that by loading only the text domains that are used in a page and even more, by caching them.
PO and MO files are designed to be used with PHP Gettext-extension. But since it\’s an extension, it\’s not installed by default on all hosting platforms. To overcome this barrier, WordPress has re-implemented the whole MO file parsing in PHP completely ignoring the possibility to use native gettext, if available. This WordPress\’ implementation is a bit slow.
This plugin has another implementation of MO parsing, which is faster than the default one. The plugin also loads only the text domains that are required to generate the current page instead the default behavior of loading every available text domain. As front end pages usually only use strings from few text domains, this leads to a great performance boost in front end.
To boost the performance even more, the plugin also caches the loaded text domains in to the object cache. For optimal performance you need a fast object cache backend like Redis, Memcached or APC(u).
Links

GitHub

延伸相關外掛

文章
Filter
Apply Filters
Mastodon