Endless translations problems with WooCommerce

Hello.

I’m getting really tired of endless translations problems with WooCommerce.

My setup:

Staging page is http://nyr.rsimport.is

Translation files for WooCommerce in these folders on the server:

/wp-content/languages/plugins (woocommerce-admin-is_IS.po and .mo and woocommerce-is_IS.po and .mo)
/wp-content/languages/themes (x-is_IS.po and .mo)
/wp-content/languages/woocommerce (woocommerce-admin-is_IS.po and .mo and woocommerce-is_IS.po and .mo)

/wp-content/themes/x-child/framework/lang (woocommerce-admin-is_IS.po and .mo and woocommerce-is_IS.po and .mo)
/wp-content/themes/x-child/languages (woocommerce-admin-is_IS.po and .mo and woocommerce-is_IS.po and .mo)

I also have a function in functions.php in my child theme where I directly translate some strings

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ð!'
	);

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

	return $translated_text;
}

Everything in the WP system is set to Icelandic and in the beginning WooCommerce was in Icelandic in the back- and frontend of the site.

Suddenly this changed a few days ago. The backend is now in English and some strings are in English also on the site itself.

If you add a product to the cart and then view the cart, at the bottom where the price is the word Shipping is always in English !!! This is making me crazy…

Also when you view a product category (http://nyr.rsimport.is/voruflokkur/garmin/sportid/hlaupid/ for example) you can see that the drop down for sorting is in English also.

My client has now complained about the backend being in English so I need that fixed as well.

Please help me with this ASAP.

Hello There,

Thanks for writing in!

You have all the translation files scattered which resulted to a conflict.

To resolve this, please move all your translation files in the wp-content/languages/ area. Please get the updated translated file and add it in wp-content/languages/themes/ and wp-content/languages/plugins/.

/wp-content/languages/plugins/woocommerce-admin-is_IS.po
/wp-content/languages/plugins/woocommerce-admin-is_IS.mo 
/wp-content/languages/plugins/woocommerce-is_IS.po
/wp-content/languages/plugins/woocommerce-is_IS.mo

/wp-content/languages/themes/__x__-is_IS.po
/wp-content/languages/themes/__x__-is_IS.mo

I noticed that you have incorrectly named the X translation file. It should only be __x__. Once you have it in place, you must remove all those po/mo files in the child theme so that we can concentrate only in the .po and .mo files and the one you have in your child theme’s functions.php file.

Please let us know how it goes.

Ok, now I have the files in place as you suggested and removed all the files from the child theme. Also renamed the files for the X theme.

The WooCommerce backend is still in English.

Hello There,

Thanks for updating in! Did you already translated the keywords in your translation file? Please check your language settings in Settings > General. And to better assist you with this issue, please provide us access to your site so we can take a closer look and fix the issue? To do this, you can make a post with the following info:
– Link to your site
– WordPress Admin username / password

  • FTP Hostname
  • FTP Username
  • FTP Password

Thank you.

I think I have fixed this problem now… finally !

I removed my language files from the /wp-content/languages/plugins folder and uploaded the woocommerce-is_IS.po and .mo files there (after I downloaded them from here https://translate.wordpress.org/projects/wp-plugins/woocommerce/stable/is/default).

Now it seems to me that everything is in Icelandic again!

Thanks for your support.

1 Like

You’re welcome. Glad we could help.

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