Hi @flipgatt, whatever files you replace, update or modify in any way inside /wp-content/plugins/mailpoet/ will always get overwritten on plugin update.
To prevent that, you’ll have to add the custom translations to some other folder and write a script (or MU plugin in wp-content/mu-plugins/) to load them, something like this (I haven’t try that, but should work in theory):
<?php
/**
* Plugin Name: MailPoet custom Italian translation
*/
add_filter(
'load_textdomain_mofile',
static function ($mofile, $domain) {
if ($domain !== 'mailpoet' || basename($mofile) !== 'mailpoet-it_IT.mo') {
return $mofile;
}
$custom = WP_CONTENT_DIR . '/languages/custom/mailpoet-it_IT.mo';
return file_exists($custom) ? $custom : $mofile;
},
10,
2
);
You can read more about loading custom translations in https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/#plugins-on-wordpress-org and here is documentation for that function https://developer.wordpress.org/reference/hooks/load_textdomain_mofile/.
-
This reply was modified 1 day, 22 hours ago by
Ján Mikláš.
I have /public/languages/plugins
as my installation is multi-site
I place my own .po .mo there, but it is overwritten when there is an upgrade
with woo commerce plugin this does not happen, files are not overwritten
thanks