Securing langugae folder

The short answer is to use the location wp-content/languages/woocommerce/ to store custom translations.

See WooCommerce documentation.

This location should be safe from all WordPress updates. Folders parallel to languages/plugins and languages/themes will not be modified.


To your specific questions:

is there a way to make whole wp-content/languages folder safe for updating?

You can control automatic translation updates with the auto_update_translation filter. e.g.

add_filter( 'auto_update_translation', '__return_false' );

However, this hook does not fire when doing manual updates from wp-admin. This will only protect the folder when doing automatic updates and will stop all your other plugins benefiting from translation updates.

Is there a way to add it to child theme or something to make my custom translations update secure?

Adding translations of a plugin into a child theme suggests a common expectation that WordPress will search your theme for alternative plugin localizations. It won’t.

However, you can use filters to change the MO file paths that are loaded. Here’s a really simple example:

function filter_load_textdomain_mofile( $mopath, $domain ){
  if( 'woocommerce' === $domain ){
    $mopath = str_replace('/languages/plugins/','/languages/other/',$mopath);
  }
  return $mopath;
}
add_filter('load_textdomain_mofile','filter_load_textdomain_mofile',999,2);

You can use this filter to do all sorts of stuff, like merge translations together etc.. You might find this useful if you need to do this to another plugin that doesn’t provide an alternative, safe location.