• Resolved jmonesti

    (@jmonesti)


    Hello James !

    Nice plugin of yours !

    However, I’ve been trying to translate (part of) it, with no luck so far…

    What I’ve done :
    . cp languages/woocommerce-product-archive-customiser-en_GB.po languages/woocommerce-product-archive-customiser-fr_FR.po
    . edit the ‘Out of stock’ tag
    . produce a languages/woocommerce-product-archive-customiser-fr_FR.mo (using poedit)

    But my translation is not taken in account, however.

    I’m not certain where to put my -fr_FR.mo !?

    Is it under
    wp-content/plugins/woocommerce-product-archive-customiser/languages
    or under
    wp-content/languages/plugins ?

    I’ve tried both, unsuccessfully…

    I’m also wondering why there is no woocommerce-product-archive-customiser-en_GB.mo ? No need for, as the plugin is ‘natively’ in english ?

    Please let me know…

    All the best

    https://ww.wp.xz.cn/plugins/woocommerce-product-archive-customiser/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jmonesti

    (@jmonesti)

    Okay…

    I’ve understood why my woocommerce-product-archive-customiser-fr_FR.mo is not taken in account…

    First, it shall be copied into wp-content/plugins/woocommerce-product-archive-customiser/languages

    Second, in the file archive-customiser.php, the function woocommerce_pac_show_product_stock() gets the translation out of the text domain ‘woothemes‘. Replace this text domain with ‘woocommerce-product-archive-customiser‘, and the wp-content/plugins/woocommerce-product-archive-customiser/languages/woocommerce-product-archive-customiser-fr_FR.mo will be used

    Bye

    Thread Starter jmonesti

    (@jmonesti)

    Speaking for myself, I’ve rewritten the function woocommerce_pac_show_product_stock() this way

    function woocommerce_pac_show_product_stock() {
    	global $product;
    	$stock = $product->get_total_stock();
    	if ( ! $product->is_in_stock() ) {
    		echo '<p class="stock out-of-stock"><small>' . __( 'Out of stock', 'woocommerce' ) . '</small></p>';
    	} else {
    		echo '<p class="stock in-stock"><small>' . $stock . ' ' . __( 'In stock', 'woocommerce' ) . '</small></p>';
    	}
    }

    so that it takes the translation out of the text domain ‘woocommerce’ for the front-end

    Bye

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘i18n’ is closed to new replies.