Why does WordPress not make use of gettext directly?

When your .mo files are however put to use in your application under the hood, wordpress parses your translation files into an associative array and extracts the translations as such, instead of relying on the native PHP gettext functions.

Because it isn’t installed often and not always available, so a PHP based mo reader is needed no matter what they decided.

The same was true of several other language features that depended on the standard library because it was possible in PHP 5.2 and older to turn them off.

Keep in mind that WordPress installs serve trillions of page views per hour across every possible kind of install on hugely varying machines from super computers to embedded devices. Changing server requirements isn’t done lightly, and changes that sound straightforward and sensible, even obvious, can have unexpected and difficult consequences

A ticket does exist to make use of it in the case that the extension is installed:

https://core.trac.wordpress.org/ticket/17268

More recently, there have been efforts to evaluate translation performance and improve things:

https://make.wordpress.org/core/2023/07/24/i18n-performance-analysis/

The general consensus around native gettext is that it has a poor API, the low install base means very few will benefit, and of those that do install it most have very few locales installed which causes problems, particularly since they need installing at a server level, not to mention concerns around disk usage, hardlinks, file copies, etc.

Plugins do exist so if you’re happy to do it all yourself you can get those benefits. Performance checks indicate it gives a big speed boost but not as big as PHP based MO parsers such as Ginger MO.

Instead the current best contender is to translate the po/mo files into PHP files so that the loading and parsing step can be skipped entirely after the first attempt. Note for future readers that this is not a finalised process and you should refer to the Make WP blogs to find progress or discover what happened. Take a look at the performant translations plugin and the performance Make blog.

deneme bonusudeneme bonusu veren sitelerpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casino