• Resolved AleCss

    (@alecss)


    Hi there, I have created a beautiful form on https://habitatbimbo.it but I can’t change the text “Press to select” that appear on modern select fields. In the screenshot you can see what I mean.

    https://prnt.sc/vioi0c

    Thank you very much

    Alex

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Jade

    (@jadeam)

    Hi @alecss,

    You should be able to translate those text using translation plugins such as LocoTranslate. I’d recommend checking out our tutorial: https://wpforms.com/docs/how-to-translate-wpforms-into-a-different-language/. That should hopefully share all of the details you’d need to get up and running with a new language in your forms.

    I hope this helps!

    Thread Starter AleCss

    (@alecss)

    Hi, thank you for your response. I don’t need to translate my forms in another language. They are already well translated in Italian. I have need only to translate that short sentence that I have show in my screenshot: “Press to select” in select’s options field.

    I’m already using Polylang and I don’t want to install another plugin for languages.

    Maybe, I can traslate it with custom string translation offered by polylang functions. Do you have some idea?

    Thanks

    Thread Starter AleCss

    (@alecss)

    The problem is that “Press to select” is the value of an html attribute, to be precise the “data-select-text” attribute. And I have no idea how to target that attribute to translate it.

    I have already tried to use pll_register_string function (Polylang), but without success.

    Thread Starter AleCss

    (@alecss)

    I have tried Loco Translate and I have solved this problem. But if I do not want to use Loco Translate, how can I do?

    Thanks

    Hello @alecss,

    Please try adding this code on your site:

    // Translate Strings
    add_filter( 'gettext', 'translate_wpforms_strings', 20, 3 );
    
    function translate_wpforms_strings( $translated_text, $text, $domain ) {
        switch ( $translated_text ) {
            case 'Press to select.' :
                $translated_text = __( 'Your Press to select translation.', 'wpforms-lite' );
                break;
        }
        
        return $translated_text;
    }
    

    In case it helps, here’s our tutorial with the most common ways to add custom code like this.

    For the most beginner-friendly option in that tutorial, I’d recommend using the Code Snippets plugin.

    I hope this helps!

    Hi @alecss,

    We haven’t heard back from you in about a week, so I’m going to go ahead and close this thread for now. But if you’d like us to assist further, please feel welcome to continue the conversation.

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Change “Press to select” text on select elements’ is closed to new replies.