Before you ask please READ THIS

How to avoid translation files getting updated by Wordpress

edited April 2017 in FatMoon Posts: 24
Hi!

I have an issue, which is not directly connected to the theme, but I hope you have an idea about this anyway.

I have made a site for a client, who needed some translations in WooCommerce, because the regular Norwegian terms that are used in the translations files were not suitable for his use.

First, I made these changes in the translation files, before realizing that Wordpress is updating these.

So I found a code for making WP not update:
add_filter( 'auto_update_translation', '__return_false' );

But this is not working. The translation files are still updating every time WP or any plugin is updated.

I tried to move translation files to the child theme, with no luck.

Then I tried this function, which makes 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?

Best regards,
Bjorn
Post edited by tonicoslo on

Comments

  • AirAir
    edited April 2017 Posts: 10,970
    Hello there:-)

    It is great question that you ask, however even I gave it 30 minutes I don't know the best answer.

    Copy your question to general WordPress forum and there you should find someone that will push you in right direction, as you seem to be close to answer.

    Good luck!

    With kind regards.
    Post edited by Air on
  • Posts: 24
    I see :) I will do that. Thanks!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!