Theme translation child theme error

Hello,

When I translate pro theme with instructions provided here with poedit :https://theme.co/apex/forum/t/setup-translation/61.
I add po and mo files to created languages folder where child theme is and after adding this code:

add_action( ‘after_setup_theme’, ‘load_child_language’ );
function load_child_language() {
load_child_theme_textdomain( ‘x’, get_stylesheet_directory() . ‘/languages’ );

I get following error:
Parse error: syntax error, unexpected end of file in /var/www/vhosts/mhealth.lt/httpdocs/wp-content/themes/x-child/functions.php on line 87

I can see that article was last updated December 9, 2016. Maybe I get this error because I use pro, not x-theme?

Lukas

Hey Lukas,

Thanks for writing in! Please check the code and make use of this code instead:

add_action( 'after_setup_theme', 'load_child_language' );
function load_child_language() {
   load_child_theme_textdomain( 'x', get_stylesheet_directory() . '/languages' );
}

Please let us know if this works out for you.

Hello,

This code did not cause any errors, however x.po file I translated with poedit did not change anything. Like return to shop button or apply coupon or related products.
I did everything with instructions provided in your knowledgebase.

Lukas

Allright, I’ve found some workaround solutions for apply coupon, return to shop and related products. However I still have some trouble with a few elements:

  1. In checkout page I cannot translate I’ve read and accept the terms & conditions * . I’ve tried a solution provided here with no luck:https://theme.co/apex/forums/topic/how-to-translate-the-ive-read-and-accept-the-terms-conditions-to-spanish/
  2. For whatever reason I see two headlines in cart page, when cart is empty before uploading translation files it showed one line in english Your cart is currently empty and one line in Lithuanian:Krepselis dar tuscias. I want to see only one line there.

Hello There,

Thanks for updating in! For best results, you may not need your custom code. Just do the following:
1.) Please open x.pot in PoEdit (or any other software that you are using)
2.) Save it as __x__-en_US.po or __x__-es_ES.po depending on the language that you are translating
3.) Upload this file in this location wp-content/languages/themes/

For more information, please check this out: https://theme.co/apex/forum/t/setup-translation/61

Hope this helps.

I do not seem to find I’ve read and accept the terms and conditions string in x.po

Hi there,

For that section please kindly read this thread: https://theme.co/apex/forums/topic/how-to-translate-the-ive-read-and-accept-the-terms-conditions-to-spanish/

Thank you.

As I have mentioned above, I already tried this solution and it did not work, text did not change.

Hi There,

Please add the following code under functions.php file locates in your child theme:

add_filter('gettext', 'x_translate_text1' );
function x_translate_text1($translated) { 
	$translated = str_ireplace('I&rsquo;ve read and accept the <a href="%s" class="woocommerce-terms-and-conditions-link">terms &amp; conditions</a>', 'Your new text <a href="%s" class="woocommerce-terms-and-conditions-link">your new text</a>', $translated);
	return $translated; 
}

Hello Thai,

Thank you, this code worked. I have one more problem with terms and conditions, on checkout page, when you click terms and conditions link it opens up text but it does not scroll down or up on PC, however it does scroll just fine on mobile or tablet. Do you know what might be the problem?

Lukas

Hey Lukas,

I have clicked the terms and condition and I can scroll at it.
Please check my screenshot: http://prntscr.com/ft0yv5

You might be having browser cache issues. Please clear your browser cache or use private browsing mode and test it again.

Please let us know how it goes.

Hello,

I have tried clearing cache and it did not help. And for whatever reason it does not work on my PC on chrome, but on Explorer it does. No worries, I will try and reinstall my chrome maybe it will help.

Thanks.

Hi There,

I’m also in PC using Chrome and I can scroll terms and conditions. Yes try re-installing/updating your Chrome to the latest version.

Thanks,

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