Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1272320
    canismundi
    Participant

    Hi,
    I want to traduce visual things in the page.
    I am using the Loco plugin.
    I want to traduce some words like, The woocmoerce cart button text, and other words from learndash plugin.
    I have made the tranlation, but some words are tranlated, and some are not.
    I have read a lot , before asking. But no solution for me.
    Please check

    #1272323
    canismundi
    Participant
    This reply has been marked as private.
    #1272485
    Rad
    Moderator
    This reply has been marked as private.
    #1273654
    canismundi
    Participant
    This reply has been marked as private.
    #1274301
    Christian
    Moderator

    You need to edit the page in Cornerstone and change the words manually in the Pricing Table element (see attachment). There’s no automatic way of translating that.

    Thanks.

    #1279793
    canismundi
    Participant

    Yes, I know. But I want to translate the cart. At the right corner, in the header. I translate the things with loco translate or directly in the child-theme or theme, but something forces the english words. You know? Appears in spanish just a half second and then chancges to english.

    #1279840
    Thai
    Moderator

    Hi There,

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

    add_filter('ngettext', 'x_translate_carts' , 20, 3);
    function x_translate_carts( $translated_text, $single, $plural ) {
    
    	$translation = array(
    		'%s Item'      => '%s Commentaire',
    		'%s Items'     => '%s Commentaire'
    	);
    
    	if( isset( $translation[$single] ) ) {
    		return $translation[$single];
    	}
    	if( isset( $translation[$plural] ) ) {
    		return $translation[$plural];
    	}
    	return $translated_text;
    }

    Replace Commentaire with your texts.

    Hope it helps ๐Ÿ™‚

    #1279850
    canismundi
    Participant

    MAybe I have to do something more?
    It doesn’t work ๐Ÿ™

    #1279855
    Thai
    Moderator

    Hey There,

    I replaced with this code and it seems to work:

    add_filter('ngettext', 'x_translate_text' );
    function x_translate_text($translated) { 
      $translated = str_ireplace('Items', 'Productos', $translated);
      $translated = str_ireplace('Item', 'Productos', $translated);
      return $translated; 
    }

    Cheers!

    #1279857
    canismundi
    Participant

    For me works , only when you are logged in, but doesnt when are logged out. Please watch it.
    I am thinking leave the word items. But, i have the same problem in other places of X theme and woocomerce…
    And I have read the same problem in forum a lot of times. Could be a better solution? That solves the global problem?
    ^^Lost in translation^^

    #1279915
    Thai
    Moderator
    This reply has been marked as private.
    #1280019
    canismundi
    Participant

    Now it works fine! Thanks a lot

    #1280251
    Rue Nel
    Moderator

    Youโ€™re welcome! We’re happy to help you out.
    If you need anything else we can help you with, don’t hesitate to open another thread.

  • <script> jQuery(function($){ $("#no-reply-1272320 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>