Translating terms and conditions link on checkout page

Hello

I have been searching for some time where I can translate the text: I have read and agree to the website terms and conditions *

My site is https://www.garminbudin.is and you need to add a product to the cart and go to checkout to see this string.

I have translation files in /wp-content/languages/plugins and the text is translated there but nothing changes. I also have this in my functions.php file in the child theme:

add_filter('gettext', 'x_translate_text' , 20, 3);

add_filter(‘ngettext’, ‘x_translate_text’ , 20, 3);
function x_translate_text ( $translated_text, $text, $domain ) {

$translation = array (
	'%s has been added to your cart.' => '%s er kominn í körfuna þína.',
	'Your cart is currently empty.' => 'Karfan þín er tóm eins og er',
	'Return To Shop' => 'Fara aftur í vefverslun',
	'%s have been added to your cart.' => '%s eru komin í körfuna þína.',
	'You are now logged in as <strong>%s</strong>' => 'Þú ert núna skráð/ur inn sem <strong>%s</strong>',
	'View Cart' => 'Skoða körfu',
	'%s removed.' => '%s fjarlægt úr körfunni þinni.',
	'Undo?' => 'Sækja vöru aftur í körfu?',
	'Postcode / ZIP' => 'Póstnúmer',
	'Clear' => 'Hreinsa',
	'Related Products' => 'Tengdar vörur',
	'You may be interested in&hellip;' => 'Þú gætir einnig haft áhuga á&hellip;',
	'Shipping costs will be calculated once you have provided your address.' => 'Sendingarkostnaður er reiknaður út þegar þú hefur skilgreint heimilisfang í næsta skrefi.',
	'Billing details' => 'Upplýsingar um greiðanda.',
	'Order notes' => 'Athugasemdir með pöntun.',
	'Shipping' => 'Sendingarmáti.',
	'Notes on your order, e.g. special notes concerning delivery.' => 'Hér getur þú sett inn nánari upplýsingar ef þú vilt.',
	'Apply Coupon' => 'Nota afsláttarkóða',
	'View cart' => 'Skoða körfu',
	'Cart totals' => 'Karfan',
	'Update cart' => 'Uppfæra körfu',
	'Shipping' => 'Sendingarmáti',
	'Proceed to checkout' => 'Ganga frá greiðslu',
	'Product categories' => 'Vöruflokkur',
	'Search products...' => 'Leita að vörum',
	'Apartment, suite, unit etc. (optional)' => 'Íbúðanúmer eða aðrar upplýsingar, valkvæmt',
	'House number and street name' => 'Heiti götu og húsnúmer',
	'Be the first to review &ldquo;%s&rdquo;' => 'Vertu fyrst/ur til að skrifa umsögn um &ldquo;%s&rdquo;',
	'Product' => 'Heiti vöru',
	'Price' => 'Verð',
	'Quantity' => 'Magn',
	'Total' => 'Samtals',
	'Available on backorder' => 'Í boði sem biðpöntun',
	'Coupon code' => 'Afsláttarkóði',
	'Subtotal' => 'Samtals í körfu',
	'Shipping' => 'Sendingarkostnaður',
	'Add to cart' => 'Setja í körfu',
	'Categories:' => 'Vöruflokkar',
	'Category:' => 'Vöruflokkur',
	'Description' => 'Lýsing',
	'Sale!' => 'Tilboð!',
	'I have read and agree to the website <a href="%s" target="_blank" class="woocommerce-terms-and-conditions-link">terms and conditions</a> *' => 'Ég hef lesið og samþykki <a href="%s" target="_blank" class="woocommerce-terms-and-conditions-link">skilmála vefsíðunnar</a> *'
);

if( isset( $translation[$text] ) ) {
return $translation[$text];
}

return $translated_text;

}

But nothing changes on the site itself. Can you help me with this ?

Hey @gretar,

Based on the official WooCommerce translation guide at https://docs.woocommerce.com/document/woocommerce-localization/, your setup is incorrect. Please follow the instructions in the translation guide.

Also, X and Pro does not override the “terms and condition” text so you should be translating the WooCommerce plugin for this.

Thanks.

Hello

I have now set my language files into /wp-content/languages/woocommerce folder and nothing changes. I also noticed that this string is not in the .po/.mo files for the WooCommerce language, so where can I translate this string ?

I downloaded the latest stable file from WooCommerce for Icelandic and found the string there. But it is like I have read and agree to the website %s and now on the website the words terms and conditions are still in English.

Translating WooCommerce is the most annoying thing there is !

Woohoo !! I found it.

Everything is fixed now

Glad to hear everything is working now.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.