Tagged: x
-
AuthorPosts
-
March 1, 2017 at 3:10 am #1389953
Hello
I have a site, http://www.jotunn.is and when displaying cross sells I can not translate this text You May Be Interested In…
I have this function in my child theme functions.php but it does not work
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. %sUndo?%s' => '%s fjarlægt úr körfunni þinni. %sSækja vöru aftur í körfu?%s', 'Postcode / ZIP' => 'Póstnúmer', 'Clear' => 'Hreinsa', 'Related Products' => 'Tengdar vörur', 'You May Be Interested In…' => 'Þú gætir einnig haft áhuga á…', 'Apply Coupon' => 'Nota afsláttarkóða' ); if( isset( $translation[$text] ) ) { return $translation[$text]; } return $translated_text; }
Can I get some help on this ?
March 1, 2017 at 4:59 am #1390053Hey there,
Please follow this translation instruction https://community.theme.co/kb/translation/
Thanks.
March 1, 2017 at 6:20 am #1390149I have everything translated in PoEdit files but this string is not in the language files and that is why I have this function in functions.php to translate extra strings not found in the language files for the theme. I have a child theme where the language files are stored so they are not overwritten when the theme is updated.
So please help me with this function or tell me where exactly I can translate this string and also have it so that it does not get overwritten in the next update.
March 1, 2017 at 7:47 am #1390266That string is available in
wp-content\themes\x\framework\lang\x.pot
asYou May Be Interested In…
(see attachment)Try replacing
You May Be Interested In…
in your code with the proper stringYou May Be Interested In…
Thanks.
March 1, 2017 at 7:49 am #1390268Thanks ! the … was exactly what I was missing.
March 1, 2017 at 9:04 am #1390364You’re welcome.
-
AuthorPosts