WooCommerce - Translate Word On Checkout Page
I am trying to translate a word to a WooCommerce checkout page. My site is in Dutch, but they didn't translate it well, so I want to use a different word.
What needs to be translated
This refers to the following line:
"Totaal âŦ 469.38 (Inclusief âŦ 79.38 Linen )"
In English it says:
"Total âŦ 469.38 (includes âŦ 79.38 tax )"
This is a line that summarizes the total order amount. And I want to translate the word "browning" into "BTW".
What i tried
-
Selected settings in WooCommerce
-
Loco-translator plugin installed
-
Searched for a word from FTP (Adobe Dreamweaver)
Since I couldn't find the word "toasting" anywhere, I found a php file with a string element.
I found this in the PHP document wc-cart-functions.php:
if ( ! empty( $tax_string_array ) ) {
$value .= '<small class="includes_tax">' . sprintf( __( '(Includes %s)', 'woocommerce' ), implode( ', ', $tax_string_array ) ) . '</small>';
}
And this is what the HTML part looks like:
<small class="includes_tax">
(inclusief
<span class="amount">âŦ79,38</span>
Belasting)
</small>
My question
I am assuming it is printing the word "toasting" with the variable "% s". However, I cannot find content for this variable anywhere.
So can anyone help me find how to translate this word?
Thanks for reading and I will appreciate your help.
source to share
You can try using gettext filter
Example
function my_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Related Products' :
$translated_text = __( 'Check out these related products', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'my_text_strings', 20, 3 );
source to share
The Includes part supports translation. those. you just need to add it to your translation file:
Translation file in my case (Danish): " ../wp-content/languages ââ/plugins/woocommerce-da_DK.po "
Open the file in a text editor such as. Notepad ++ and add the following lines:
#: includes/class-wc-order.php:40 includes/wc-cart-functions.php:246
msgid "(Includes %s)"
msgstr "(Inkluderer %s)"
Now you need to compile the PO file to MO file and you can use Poedit. Just open the PO file and save it, it will create a new MO file that you can download and replace the current MO file (path: " ../wp-content/languages ââ/ plugins / ")
So it's so good!
With regard to part of the tax. This is controlled in the admin module:
source to share