After installing this plugin, the error log is filling up with two types of errors:
Version 1.1.3 on WordPress 6.4.5 with PHP 8.3.
]]>I now get
Native Gettext warning: Another plugin has an override_load_textdomain filter active and some translations have been handled by the MO class instead of the NativeGettextMO class. Performance is not the best it could be.
when either plugin Members or Blocksy Companion is active. I can’t find that they really user ‘override_load_textdomain’ filter.
This admin notice, all such undismissable admin notices, are annoying. Such should be in Site Health, as a test or just info. The plugins now goes deactivated and stay there until this notice is gone.
]]>Hello and thank you for the plugin.
Sorry for giving this plugin a bad review, as the problem was not this plugin. Replaced with a new review.
I installed it on three old sites, observed not working for most core translations in admin. Now installed other places, it works. The explanation I found is that the older sites all had this experimental MU plugin https://gist.github.com/soderlind/610a9b24dbf95a678c3e#file-a_faster_load_textdomain-php
I had forgotten about that one staying in mu-plugins, and I’m sorry for that.
Once disabled, it works perfect. This MU plugin saves translations to transients, and with an persistent object cache this is efficient.
May they be combined, and if so, what changes need to be made? My goal is still to have translations in shared memory.
]]>This is really neat. Thank you @colinleroy!
Only one warning reappears sometimes.
PHP Warning: Cannot modify header information - headers already sent in .../plugins/native-gettext/classes/class-native-mo.php on line 119
And right now I’m not able to reproduce triggering this warning. Unlikely.
So I thought about, what could be the reason, had a look into line 119 and so on and came up with:
add_filter( 'override_load_textdomain', array( $this, 'nltd_load_textdomain_override' ), 0, 3 );
Because all of the plugins logic happens inside the running filter hook, we’re not allowed to output anything here, even headers
. But what if you use wp_headers instead?
I tested it replacing your existing line 119 by the following lines, what – indeed – is an ugly hack, but worked.
add_filter( 'wp_headers', function ( array $headers ) : array
{
$headers[] = "X-Native-Gettext: 1";
return $headers;
} );
What do you think?
]]>