Support » Plugin: Loco Translate » Purge translation

  • Resolved kureman



    I tried to translate to french a string on a WooCommerce block (“All Products”)
    The string is %d in cart
    It didn’t worked, the text on the page remains in english.
    BUT, when I edit the page, the text is in french.

    I uninstalled Loco Translate and the problem remains.

    By inspecting the code on the WP editing page, I saw that the text in the button (%d in cart) is still using

    <script id='wc-all-products-block-js-translations'>
    ( function( domain, translations ) {
    	var localeData = translations.locale_data[ domain ] || translations.locale_data.messages;
    	localeData[""].domain = domain;
    	wp.i18n.setLocaleData( localeData, domain );
    } )( "woocommerce", {"translation-revision-date":"2021-11-11 09:40+0000","generator":"Loco https:\/\/\/","source":"packages\/woocommerce-blocks\/build\/all-products.js","domain":"woocommerce","locale_data":{"woocommerce":{"":{"domain":"woocommerce","lang":"fr_FR","plural-forms":"nplurals=2; plural=n > 1;"},"%d in cart":["%d dans le panier","%d dans le panier"],"Add new product":["Ajouter un nouveau produit"],"Add to cart":["Ajouter au panier"],"All Products":["Tous les produits"],"Available on backorder":["Disponible sur commande"],"Average rating":["Moyenne des notes"],"Cancel":["Annuler"],"Columns":["Colonnes"],"Default sorting":["Tri par d\u00e9faut"],"Edit":["Modifier"],"Learn more":["En savoir plus"],"Left":["Gauche"],"Next page":["Page suivante"],"No products found":["Aucun produit trouv\u00e9"],"Page %d":["Page %d"],"Previous page":["Page pr\u00e9c\u00e9dente"],"Price":["Prix"],"Product on sale":["Produit en promotion"],"Product Title":["Nom du produit"],"Products":["Produits"],"Right":["Droite"],"Sale":["Promo"],"Sale price":["Tarif promo"],"SKU:":["UGS\u00a0:"],"Sorry, this product cannot be purchased.":["D\u00e9sol\u00e9, ce produit ne peut \u00eatre achet\u00e9."],"WooCommerce":["WooCommerce"]}}} );

    In fact, I found 22 lines using in this editing page
    There are only 3 on normal page.

    I think this causes a bug when I update WooCommerce from 5.8.0 to 5.9.0. and I would like to purge all the links to Loco Translate on my website. Is it possible to do that?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Tim W


    Just to be clear: nothing is using A file is being loaded that you generated previously with the Loco Translate plugin. My website is not being contacted.

    I think this causes a bug when I update WooCommerce from 5.8.0 to 5.9.0.

    If you update WooCommerce you must update your translation files. It is not automatic. See Using the Sync function

    I would like to purge all the links to Loco Translate on my website.

    You can delete any translation file from the Loco Translate plugin. Either hover over it in the WooCommerce overview page and click delete, or from the editor view click the Delete tab.

    Note that your 22 files (or 3 files) are separate JSON files which are all compiled from a single PO. Deleting the PO will delete all dependant JSON and MO files.

    Thread Starter kureman


    Hi @timwhitlock,

    Thank you for your feedback!

    Sorry, I am a beginner with WordPress..

    Let me explain the situation again, maybe I have not being very clear 🙁

    1. I have installed Loco Translate, added a translation to WooCommerce (5.8.0, sync) to translate in the block named “All Products” the string “%d in cart” to “%d dans le panier”
    2. I deleted this translation
    3. I removed all the Loco Translate backups for WooCommerce
    4. I uninstalled Loco Translate.

    My question is: why do I still see the translation in the WooCommerce block BUT only when I edit the page?
    I tried to reproduce this behavior on another site but without any success yet 🙁

    Plugin Author Tim W


    why do I still see the translation in the WooCommerce block BUT only when I edit the page?

    I can’t say for certain why you see it only when you edit the page. Possibly because the editing page uses one particular JSON translation file that exists, and other pages use different files that don’t. (This is a guess). The same translations may be compiled to multiple files, but as I said – deleting the master PO file via Loco Translate should remove all its dependants. This won’t happen if you delete just the PO manually.

    The bottom line is that if a file exists it will be used. If you still see it then either the page is cached or the file still exists and you did not delete it successfully. If the latter I cannot say why.

    Note that uninstalling Loco Translate does not delete any translation files. If deleting a PO file does not delete its dependants then possibly there’s a bug or a file permission issue, but I can’t reproduce whatever is happening on your server.

    Thread Starter kureman


    I deleted the master PO as you suggested and it worked! Thank you very much for your fast and efficient support!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Purge translation’ is closed to new replies.