• Resolved dodog

    (@dodog)


    On every WooCommerce update, outdated language file is downloaded and overwrites my current language file. This action removes the translated strings and replaces them with English ones.
    I tried to place the language file in /wp-content/languages/plugins/and in /wp-content/languages/plugins/woocommerce, but it does not help.
    I tried also steps in https://wordpress.org/support/topic/how-do-i-disable-automatic-translation-file-updates/ but do not seems to work.
    I tried to upload my translations long time ago to https://translate.wordpress.org/locale/sk/default/wp-plugins/woocommerce/ but it seems to be abandoned.

    Every time I have to delete woocommerce-sk_SK.l10n.php and all the .json files, and upload the updated language file. This is frustrating.

    Is there a way to stop WooCommerce overwriting my updated language file with the obsolete partially translated?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello dodog,

    Thank you for contacting WooCommerce support.

    I understand you’re experiencing an issue where each WooCommerce update overwrites your custom language file, causing your translated strings to revert to English.

    To help prevent this, have you had a chance to review our documentation on creating custom translations? You can find it here: WooCommerce Localization Guide. It explains how to safely store your translations so they aren’t affected during updates.

    Let me know if you have any questions. 🙂

    Best regards.

    Thread Starter dodog

    (@dodog)

    Hi @doublezed2,
    Yes, I have read the WooCommerce Localization Guide. I translated the files using the Poedit as recommended and placed the translation in wp-content/languages/plugins.

    Making your translation upgrade safe

    WooCommerce keeps translations in wp-content/languages/plugins, like all other plugins. But if you wish to include a custom translation, you can use the directory wp-content/languages/woocommerce, or you can use the snippet.

    But it is overwritten on every update.

    Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi there!

    I understand your concern. Since you mentioned placing the translation file in the wp-content/languages/plugins directory to preserve it after updates, could you please try placing the translation file in the wp-content/languages/woocommerce directory instead and see if that works for you?

    Also, please try using the custom code mentioned in the following article to make your translation upgrade-safe:
    https://developer.woocommerce.com/docs/making-your-translation-upgrade-safe/

    Let us know how it goes!

    Thread Starter dodog

    (@dodog)

    Hi @shahzeenfarooq,

    thank you, adding the following code to functions.php solved the issue.

    // Code to be placed in functions.php of your theme or a custom plugin file.
    add_filter( 'load_textdomain_mofile', 'load_custom_plugin_translation_file', 10, 2 );

    /*
    * Replace 'textdomain' with your plugin's textdomain. e.g. 'woocommerce'.
    * File to be named, for example, yourtranslationfile-en_GB.mo
    * File to be placed, for example, wp-content/lanaguages/textdomain/yourtranslationfile-en_GB.mo
    */
    function load_custom_plugin_translation_file( $mofile, $domain ) {
    if ( 'textdomain' === $domain ) {
    $mofile = WP_LANG_DIR . '/textdomain/yourtranslationfile-' . get_locale() . '.mo';
    }
    return $mofile;
    }

    Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi there!

    You’re very welcome, I’m glad to hear that the code solved the issue!

    If you have a moment, we’d really appreciate it if you could leave a review for the WooCommerce plugin. Your feedback helps us continue to improve and support users like you.

    You can leave a review here:
    🔗 https://wordpress.org/plugins/woocommerce/#reviews

    Thanks again for using WooCommerce, and feel free to reach out anytime you need assistance!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.