Support » Plugin: Controls for Contact Form 7 » recpatcha ‘robot’ translation not working

  • Resolved chochochocosensei

    (@chochochocosensei)


    I think I may have found a clue to the recaptcha not translating problem…

    I was having the same problem, and as I was adding on to another forum post, I stumbled upon something that worked — well not really.

    My language is japanese, language code ja.

    I am using qtranslate-x, and I am using two forms, one on the english side of the page, one on the japanese side of the page. At first, I was using the plugin default on the english side and on the japanese form I am putting in values for the language. It didnt work.

    the short and skinny is that if I turn off the two forms and use just one (though this is not acceptable for the site), it appears to work not with ‘ja’, but if I put in ‘[:en]en[:ja]ja[:]’ (though it needs reloads, maybe)…but with two forms, it doesn’t.

    Out of the box, I tried just using ja, but that didn’t work. That should have worked by itself.

    Then, I tried using [:en]en[:ja]ja[:] as the language code in this plugin, per a suggestion elsewhere, but it didn’t seem to work.

    I tried changing my site’s default language to ja from en, but no go. At this point, I thought it’s a google translate problem, and checked the language…it is translated.

    Originally I had tried using this script via a snippet because I really wanted it to switch the language depending on qtranslate, but the original’s “qtranxf_getLanguage())” didn’t seem to work, so then modified it to try to hardcode the “ja”:

    function wptricks24_recaptcha_scripts() {
            wp_deregister_script( 'google-recaptcha' );
     
            $url = 'https://www.google.com/recaptcha/api.js';
            $url = add_query_arg( array(
                'onload' => 'recaptchaCallback',
                'render' => 'explicit',
                'hl' => 'ja'), $url );
     
            wp_register_script( 'google-recaptcha', $url, array(), '2.0', true );
        }
     
    add_action( 'wpcf7_enqueue_scripts', 'wptricks24_recaptcha_scripts' );

    That didn’t work.

    I was going to try turning qtranslate off…but was afraid of losing all my translations…

    Then it occurred to me to use the script above with the [:en]en[:ja]ja[:]. Voila. Sometimes, I had to reload the page to make it work in japanese. (changing the language switcher in qtranslate was not enough. other times it worked.)

    I would prefer to use your plugin, but it doesn’t seem to work, even with [:en]en[:ja]ja[:]. I tried using that on both forms, I tried changing the order of the languages. On a whim I just put qtranxf_getLanguage()) in there. Not sure where to go from here.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Actually, when I tried to go back to the setting I thought worked, using the snippet and both form and [:en]en[:ja]ja[:] in the japanese form language fields, that didn’t work. Some combination of the above seems to have worked, depending on the page reloads, but I am not sure which.

    D

    OK. I did find another clue. qtranslate has a setting
    “Detect the language of the browser and redirect accordingly.”
    Unchecking this does seem to make things more consistent, however, it still needs a one or more reloads in order to work. At first the page is in japanese. If I use the language button to change, it goes to english. So far so good. But if I change back, it stays in english. Several reloads later it turns to japanese. reload again…back ot english. several reloads later, japanese. reload again…english…the behavior is not sticking.

    This is using the plugin and the snippet or just the plugin by itself (using just ja. [:en]en[:ja]ja[:] does not seem to work).

    So it works with a page reload…any way to force a reload or find out why it is so tempermental?

    Plugin Author Kaspars

    (@kasparsd)

    That custom script in wptricks24_recaptcha_scripts() is exactly that this plugin is using. I’m not sure I understand what is [:en]en[:ja]ja[:].

    Can you please include a screenshot of the part which is not being translated?

    I see. Here are screenshots: without translation and with translation. At the bottom, near the send button, you can see “I am not a robot”…and then the japanese for this. the first is what usually shows, the second sometimes show. Just now it didn’t show a few times, it showed twice, and on next reload, it disappeared. This is with or without “detect language of browser” off in qtranslate.

    right now ja is the default language for the site, and I am using “ja” in your plugin and it still doesn’t work. neither does [:en]en[:ja]ja[:] (This is code qtranslate uses in certain places to distinguish content in one or the other language. Someone on you site said they were able to get the plugin to work with qtranslate using this code in the box.).
    The form is at: http://chocochoco.byethost4.com/wp/feedback/

    Here is the japanese form that doesnt work (the mailpoet field is new/not relevant and was not in place when the error first occurred):

    [text* your-name placeholder "名前"]
    [email* your-email placeholder "Eメール"] 
    <div style="border:1px solid blue;background:ivory;">[mailpoetsignup mailpoetsignup-745 mailpoet_list_3 label-inside-span "Check to receive our newsletter at this email address"]</div><br />
    [checkbox* your-subject use_label_element "ご意見・感想" "内容に関するご提案・リクエスト" "歌のご提案・リクエスト" "絵本のご提案・リクエスト" "問題" "提案" "Websiteについて" "その他"] 
    [textarea your-message placeholder "問合せ内容"] </label>
    
    <div style="display:table;">
    <div style="width: auto; display: table-cell; vertical-align: middle;">[recaptcha]</div>
    <div style=" width:auto; display: table-cell; vertical-align: middle;">[submit "書式を送る"]</div>
    </div>

    Here is the english side, but that is irrelevant because the english side will work in all cases:

    [text* your-name placeholder "name"]
    [email* your-email placeholder "email"]  
    <div style=" border:1px solid blue;background:ivory;">[mailpoetsignup mailpoetsignup-745 mailpoet_list_3 label-inside-span "Check to receive our newsletter at this email address"]</div><br />
    [checkbox* your-subject use_label_element "feedback" "activity request" "song request" "book request" "problem" "suggestion" "website" "other"] 
    [textarea your-message placeholder "give me the details"] </label>
    
    <div style="display:table;">
    <div style="width: auto; display: table-cell; vertical-align: middle;">[recaptcha]</div>
    <div style=" width:auto; display: table-cell; vertical-align: middle;">[submit "Send"]</div>
    </div>

    Thanks in advance for any help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘recpatcha ‘robot’ translation not working’ is closed to new replies.