[Support request] How can I translate the Read more string?

Home Forums Support [Support request] How can I translate the Read more string?

Home Forums Support How can I translate the Read more string?

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1034965
    sirlouen

    Hello
    How can I translate this string? (READ MORE LABEL)

    View post on imgur.com

    #1035311
    David
    Staff
    Customer Support

    Hi there,

    is the Site Multi Lingual ?
    If so the string should be automatically translated.

    #1035428
    sirlouen

    Yes, It’s multilingual
    https://theworldmarch.org/noticias

    As you can see it’s not translated into Spanish the “READ MORE” buttons.
    Neither to Italian

    #1035773
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Which plugin are you using to translate your site?

    #1035931
    sirlouen

    @Tom Polylang

    #1036488
    Tom
    Lead Developer
    Lead Developer

    Hmm, it should work by default as we have a wpml-config.xml file which lists that option as translatable.

    You could try something like this:

    add_action( 'init', function() {
        if ( function_exists( 'pll_register_string' ) ) {
            pll_register_string( 'gp-premium', 'Read more' );
        }
    } );
    
    add_filter( 'option_generate_blog_settings', function( $options ) {
        if ( function_exists( 'pll__' ) ) {
            $options['read_more'] = pll__( 'Read more' );
        }
    
        return $options;
    } );
    #1036491
    sirlouen

    I think the problem is that the label is displayed under the customization options. Is not an static label. I think the “Read more” you are talking about is a different Read more.

    Theorically If I override the text is the customizer, then it will appear that text unconditionally (regardless of the language)

    But if I leave it empty the button just not appears.

    #1036531
    sirlouen

    Ok, I think I’ve found the issue

    wp-content/plugins/gp-premium/langs# ls
    gp-premium-cs_CZ.mo gp-premium-da_DK.po gp-premium-fr_FR.mo gp-premium-it_IT.po gp-premium.pot gp-premium-pt_PT.mo gp-premium-ru_RU.po gp-premium-sv_SE.mo gp-premium-zh_CN.po
    gp-premium-cs_CZ.po gp-premium-de_DE.mo gp-premium-fr_FR.po gp-premium-pl_PL.mo gp-premium-pt_BR.mo gp-premium-pt_PT.po gp-premium-sk_SK.mo gp-premium-sv_SE.po
    gp-premium-da_DK.mo gp-premium-de_De.po gp-premium-it_IT.mo gp-premium-pl_PL.po gp-premium-pt_BR.po gp-premium-ru_RU.mo gp-premium-sk_SK.po gp-premium-zh_CN.mo

    There are no es_ES or it_IT translations there !

    #1036603
    sirlouen

    iT is there but no translations (i’ve put it to test it , but doesn’t work either)
    https://theworldmarch.org/it/notizie/

    View post on imgur.com

    I’ve modified the blog/functions/generate-blog.php

    View post on imgur.com

    And now it works fine the translation. Obviously, this is not a great tweak…

    #1036845
    Tom
    Lead Developer
    Lead Developer

    The code I provided above should achieve something very similar to the change you made in generate-blog.php.

    Doing this is the exact same thing, but without altering the plugin:

    add_filter( 'option_generate_blog_settings', function( $options ) {
        $options['read_more'] = __( 'Read more', 'gp-premium' );
    
        return $options;
    } );
Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.