Javascript 雷帕查翻译

Javascript 雷帕查翻译,javascript,captcha,recaptcha,Javascript,Captcha,Recaptcha,我正在尝试使用reCAPTCHA.net的captcha服务,但是我希望使用自定义翻译(),因为内置翻译并不涵盖所有语言。此外,我不想使用他们的标准主题之一,我想完全定制,以匹配验证码的外观,我的网站 下面是我正在尝试的一个片段,但是由于一些有趣的原因,它不起作用(文本仍然是英文的,而不是翻译的)。我想知道像“获取另一个验证码”、“获取音频验证码”、“帮助”等文本链接是否会翻译。如果我理解正确,这些应该翻译,这取决于我在“自定义_翻译”属性中设置的字符串。另外,如果我用图标而不是文本替换文本链接

我正在尝试使用reCAPTCHA.net的captcha服务,但是我希望使用自定义翻译(),因为内置翻译并不涵盖所有语言。此外,我不想使用他们的标准主题之一,我想完全定制,以匹配验证码的外观,我的网站

下面是我正在尝试的一个片段,但是由于一些有趣的原因,它不起作用(文本仍然是英文的,而不是翻译的)。我想知道像“获取另一个验证码”、“获取音频验证码”、“帮助”等文本链接是否会翻译。如果我理解正确,这些应该翻译,这取决于我在“自定义_翻译”属性中设置的字符串。另外,如果我用图标而不是文本替换文本链接的内容,图标会自动获得带有适当内容的ALT标记吗

例如,如果我改变这个:

<div class="recaptcha_only_if_image"><a href="javascript:Recaptcha.switch_type('audio')">Get an audio CAPTCHA</a></div>

对此,图像的alt标记是否会自动进行预填充,以便当您将鼠标悬停在图标上时,它会显示“获取音频验证码”


我问这个问题的时候,我试着选择一个标准主题,比如“主题:'red”,alt标记会根据语言自动翻译

下面是我的代码片段。我已从下面删除了我的公钥

JS

<script type="text/javascript">
    var RecaptchaOptions = {
            custom_translations : {
                    instructions_visual : "Scrivi le due parole:",
                    instructions_audio : "Trascrivi ci\u00f2 che senti:",
                    play_again : "Riascolta la traccia audio",
                    cant_hear_this : "Scarica la traccia in formato MP3",
                    visual_challenge : "Modalit\u00e0 visiva",
                    audio_challenge : "Modalit\u00e0 auditiva",
                    refresh_btn : "Chiedi due nuove parole",
                    help_btn : "Aiuto",
                    incorrect_try_again : "Scorretto. Riprova.",
            },
            lang : 'it', // Unavailable while writing this code (just for audio challenge)
            theme : 'custom', // Make sure there is no trailing ',' at the end of the RecaptchaOptions dictionary
      custom_theme_widget: 'recaptcha_widget'
    };
</script>

var RecaptchaOptions={
自定义翻译:{
说明:“假释到期,假释:”,
音频说明:“Trascrivi ci\u00f2 che senti:”,
再次播放“Riascolta la traccia音频”,
你听不到这首歌:“格式MP3中的斯卡里卡·拉特雷西亚”,
视觉挑战:“Modalit\u00e0 visiva”,
音频挑战:“Modalit\u00e0海选”,
刷新“Chiedi应获得假释”,
“帮助”\u btn:“Aiuto”,
不正确请重试:“Scorretto.Riprova.”,
},
lang:'it',//编写此代码时不可用(仅用于音频挑战)
主题:'自定义',//确保RecaptchaOptions字典末尾没有尾随'
自定义_主题_小部件:'recaptcha_小部件'
};
HTML

<div id="recaptcha_widget" style="display:none">

<div id="recaptcha_image"></div>
<div class="recaptcha_only_if_incorrect_sol" style="color:red">Incorrect please try again</div>

<span class="recaptcha_only_if_image">Enter the words above:</span>
<span class="recaptcha_only_if_audio">Enter the numbers you hear:</span>

<input type="text" id="recaptcha_response_field" name="recaptcha_response_field" />

<div><a href="javascript:Recaptcha.reload()">Get another CAPTCHA</a></div>
<div class="recaptcha_only_if_image"><a href="javascript:Recaptcha.switch_type('audio')">Get an audio CAPTCHA</a></div>
<div class="recaptcha_only_if_audio"><a href="javascript:Recaptcha.switch_type('image')">Get an image CAPTCHA</a></div>

<div><a href="javascript:Recaptcha.showhelp()">Help</a></div>

</div>

 <script type="text/javascript"
src="http://www.google.com/recaptcha/api/challenge?k=MY_PUBLIC_KEY">
 </script>
 <noscript>
 <iframe src="http://www.google.com/recaptcha/api/noscript?k=MY_PUBLIC_KEY"
    height="300" width="500" frameborder="0"></iframe><br>
 <textarea name="recaptcha_challenge_field" rows="3" cols="40">
 </textarea>
 <input type="hidden" name="recaptcha_response_field"
    value="manual_challenge">
 </noscript>

不正确,请再试一次
输入上面的单词:
输入您听到的数字:

我还附上了结果的屏幕截图。

据我所知,如果您使用自己的HTML模板,则不会使用
自定义翻译
JavaScript对象。在这种情况下,您必须使用与应用程序其余部分相同的本地化来手动翻译<如果您自己不提供HTML,而是使用其中一个预定义的主题,则会使用代码>自定义翻译。

javascript函数在哪里?@AlexRuhl,您确切指的是哪些javascript函数?
<div id="recaptcha_widget" style="display:none">

<div id="recaptcha_image"></div>
<div class="recaptcha_only_if_incorrect_sol" style="color:red">Incorrect please try again</div>

<span class="recaptcha_only_if_image">Enter the words above:</span>
<span class="recaptcha_only_if_audio">Enter the numbers you hear:</span>

<input type="text" id="recaptcha_response_field" name="recaptcha_response_field" />

<div><a href="javascript:Recaptcha.reload()">Get another CAPTCHA</a></div>
<div class="recaptcha_only_if_image"><a href="javascript:Recaptcha.switch_type('audio')">Get an audio CAPTCHA</a></div>
<div class="recaptcha_only_if_audio"><a href="javascript:Recaptcha.switch_type('image')">Get an image CAPTCHA</a></div>

<div><a href="javascript:Recaptcha.showhelp()">Help</a></div>

</div>

 <script type="text/javascript"
src="http://www.google.com/recaptcha/api/challenge?k=MY_PUBLIC_KEY">
 </script>
 <noscript>
 <iframe src="http://www.google.com/recaptcha/api/noscript?k=MY_PUBLIC_KEY"
    height="300" width="500" frameborder="0"></iframe><br>
 <textarea name="recaptcha_challenge_field" rows="3" cols="40">
 </textarea>
 <input type="hidden" name="recaptcha_response_field"
    value="manual_challenge">
 </noscript>