How to avoid translation files getting updated by WordPress
-
Hi!
I know that using Glotpress is a good way to contribute to the best updated languages files, but for this specific site I need to put translations in WooCommerce that are not commonly used.Is it possible to prevent WordPress to update language files? I tried the function mentioned below, but the translation files are still updating every time WP or any plugin is updated.
add_filter( ‘auto_update_translation’, ‘__return_false’ );I also tried to move translation files to the child theme, with no luck.
Then I tried this function, which sets translation in the functions.php:
function ra_change_translate_text_multiple( $translated ) {
$text = array(
‘Previous’ => ‘Forrige’,
‘Next’ => ‘Neste’,
‘Previous article’ => ‘Forrige’,
‘Next article’ => ‘Neste’,
‘Read more’ => ‘Les mer’,
);
$translated = str_ireplace( array_keys($text), $text, $translated );
return $translated;
}
add_filter( ‘gettext’, ‘ra_change_translate_text_multiple’, 20 );But I found that this function is only working for the theme elements, not for WooCommerce elements.
Is there a solution for my problem, that I have missed? Do I need to alter the php files directly?
Best regards,
Bjorn
- The topic ‘How to avoid translation files getting updated by WordPress’ is closed to new replies.