[Support request] Unable to change post comment section language from English to Spanish

Home Forums Support [Support request] Unable to change post comment section language from English to Spanish

Home Forums Support Unable to change post comment section language from English to Spanish

  • This topic has 5 replies, 2 voices, and was last updated 1 year ago by Elvin.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1487776
    Alfonso

    Hi,

    I am experiencing several issues while working with the Generatepress theme and the Elementor page builder. I want to change post’s comment section language from English to Spanish. Actually, I want to change “LEAVE A COMMENT” to be “¿QUE
    PIENSAS? .

    And also cannot change the designs in the comment sections. when I’m going to edit the comment section design via Elementor, It is showing “The Theme Comments skin uses the currently active theme comments design and layout to display the comment form and comments”. From there, I haven’t any option to change comment skin. Please help me to resolve this two issues.

    Thank you.

    #1487802
    Elvin
    Staff
    Customer Support

    Hi,

    For translating the “Leave a comment” text, you can try this PHP snippet:

    add_filter( 'gettext', function( $text ) {
        if ( 'Leave a comment' === $text ) {
            return 'Your new text';
        }
    
        return $text;
    } );

    Here’s how to add PHP – https://docs.generatepress.com/article/adding-php/

    For comment form styling, you’ll have to resort to custom CSS.

    A wise man once said:
    "Have you cleared your cache?"

    #1488097
    Alfonso

    Hi,

    Thank you for your support. This was not worked for me,

    But below one was worked,

    add_filter( ‘generate_leave_comment’,’tu_custom_leave_comment’ );
    function tu_custom_leave_comment() {
    return ‘¿QUE PIENSAS?’;
    }

    #1489281
    Elvin
    Staff
    Customer Support

    Oh yeah I forgot to mention you have to change the “Your new text” string to the text you want.

    I’m glad its working for you now. 🙂

    A wise man once said:
    "Have you cleared your cache?"

    #1495771
    Alfonso

    Hi,

    I also need to change comment sections “thoughts on” words to Spanish. (located at the top of the comments. This shows how many comments I have)
    I have used below code. But not worked for me. Could you please check and give me a solution for it.

    add_filter( ‘gettext’, function( $text ) {
    if ( ‘thoughts on’ === $text ) {
    return ‘comentarios sobre’;
    }

    return $text;
    } );

    Thanks

    #1496109
    Elvin
    Staff
    Customer Support

    You can try this out.

    add_filter( 'generate_comment_form_title', function(){
    			return sprintf(
    				esc_html(
    					/* translators: 1: number of comments, 2: post title */
    					_nx(
    						'%1$s comentario sobre “%2$s”',
    						'%1$s comentarios sobre “%2$s”',
    						$comments_number,
    						'comments title',
    						'generatepress'
    					)
    				),
    				number_format_i18n( $comments_number ),
    				get_the_title()
    			);
    		});

    A wise man once said:
    "Have you cleared your cache?"

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.