• Hi,

    I can’t seem to be able to translate the placeholder of the contact form dropdown. It’s set to the default “-Please choose an option-” and I would like to translate it to my website’s language. There is no problem with translating other contact form strings, but this one is not working.

    Any help would be apreciated.

    Thanks,

    Marta

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Where can we see the website in question?

    Thread Starter martahomem

    (@martahomem)

    The website is still under construction but you can find a screenshot below.

    https://ibb.co/p4zCjkN

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    OK. I’ll wait for the site to be published.

    Use this function

    function my_wpcf7_form_elements($html) {
        //wp_send_json($html );
        $text = 'your text here';
        $html = str_replace('Please choose an option',  $text, $html);
    
        return $html;
    }
    add_filter('wpcf7_form_elements', 'my_wpcf7_form_elements');
    

    I can confirm that this is a problem.

    I inserted some debug traces and found that the function wpcf7_switch_locale in includes/I10n.php is indeed called, and $locale as well as $previous_locale are correct and the translation with a French translation exists at the correct location. My suspicion is that the function is called too late, after the drop-down has already been created.

    I use the workaround suggested by @mfwebdesigner (which works) but of course it would be better to have a clean solution that uses the translation files

    • This reply was modified 8 months, 3 weeks ago by christer_f.
    • This reply was modified 8 months, 3 weeks ago by christer_f.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Placeholder Contact Form 7 dropdown’ is closed to new replies.