I’m trying to translate a word on the WooCommerce checkout page.
My website is in the Dutch language, but they translated it poorly, so I want to use a different word.
What needs to be translated
It concerns the following line:
“Totaal â¬469,38 (Inclusief â¬79,38 Belasting)”
In English this says:
“Total â¬469,38 (Includes â¬79,38 tax)”
It’s the line that sums up the total amount of the order. And I want to translate the word ‘Belasting’ to ‘BTW’.
What I’ve tried
-
Checked out settings in WooCommerce
-
Installed the plugin Loco translator
-
Searched for the word with FTP (Adobe Dreamweaver)
As I couldn’t find the word ‘Belasting’ anywhere, I did find the php-file with the element of the line.
This I found 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 how the HTML part looks like:
<small class="includes_tax">
(inclusief
<span class="amount">â¬79,38</span>
Belasting)
</small>
My Question
I presume it does print the word ‘Belasting’ with the ‘%s’ variable. However I am unable to find the content for that variable anywhere.
So can anybody help me out by finding how to translate this word?
Thanks for reading and I’d appreciate the help.
You can try using the gettext filter
Example
WooCommerce uses gettext for translations, as described here there are several methods of updating the translation, the easies of which is editing the file in
woocommerce/i18n/languages/
The “Includes” part is translate-supported. i.e. you just need to add it to your translation file:
The translation file is in my case (danish): “../wp-content/languages/plugins/woocommerce-da_DK.po“
Open the file in your texteditor, e.g. Notepad++ and add these lines:
Now you need to compile the PO file to an 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 upload and replace the current MO file (path: “../wp-content/languages/plugins/“)
So fare so good!
In regards to the “Tax” part. This is controlled in the admin module: