- Posts: 109
- Thank you received: 5
ReCaptcha Errors Not Translated
11 years 10 months ago #181406
by Ed_Hika
ReCaptcha Errors Not Translated was created by Ed_Hika
-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.6
Hello, there.
Good afternoon!
The error messages in the Hikashop ReCaptcha plugin ( www.hikashop.com/support/documentation/7...-with-recaptcha.html ) does not translate into other languages.
I have changed the code to make to use translation strings.
Here are the changes, if they are useful (and correct):
1) Changes in the _checkCaptcha() function in recaptcha.php
if (!$resp->is_valid) {
switch($resp->error){
default:
$resp->error = JText::_('CAPTCHA_ERROR_UNKNOWN');
break;
case 'invalid-site-public-key':
$resp->error = JText::_('CAPTCHA_ERROR_INVALIDPUBLICKEY');
break;
case 'invalid-site-private-key':
$resp->error = JText::_('CAPTCHA_ERROR_INVALIDPRIVATEKEY');
break;
case 'invalid-request-cookie':
$resp->error = JText::_('CAPTCHA_ERROR_INVALIDREQUESTCOOKIE');
break;
case 'incorrect-captcha-sol':
$resp->error = JText::_('CAPTCHA_ERROR_INCORRECTSOLUTION');
break;
case 'verify-params-incorrect':
$resp->error = JText::_('CAPTCHA_ERROR_INCORRECTPARAMETERS');
break;
case 'invalid-referrer':
$resp->error = JText::_('CAPTCHA_ERROR_INVALIDREFERRER');
break;
case 'recaptcha-not-reachable':
$resp->error = JText::_('CAPTCHA_ERROR_UNREACHABLERECAPTCHA');
break;
}
2) Language File
Added the following strings.
CAPTCHA_ERROR_UNKNOWN="Anti-bot Validation - Unknown error"
CAPTCHA_ERROR_INVALIDPUBLICKEY="ReCaptcha couldn't verify the public key"
CAPTCHA_ERROR_INVALIDPRIVATEKEY="ReCaptcha couldn't verify the private key"
CAPTCHA_ERROR_INVALIDREQUESTCOOKIE="The challenge parameter of the verify script was incorrect"
CAPTCHA_ERROR_INCORRECTSOLUTION="The CAPTCHA solution was incorrect"
CAPTCHA_ERROR_INCORRECTPARAMETERS="The parameters were incorrect, make sure you are passing all the required parameters"
CAPTCHA_ERROR_INVALIDREFERRER="Invalid referer, reCAPTCHA API keys are tied to a specific domain name for security reasons"
CAPTCHA_ERROR_UNREACHABLERECAPTCHA="We couldn't contact the reCAPTCHA server to verify your answer. Please try again."
Note that only the 'incorrect-captcha-sol' case has been tested.
Hope this helps.
Take care!
-- Joomla version -- : 3.3.6
Hello, there.
Good afternoon!
The error messages in the Hikashop ReCaptcha plugin ( www.hikashop.com/support/documentation/7...-with-recaptcha.html ) does not translate into other languages.
I have changed the code to make to use translation strings.
Here are the changes, if they are useful (and correct):
1) Changes in the _checkCaptcha() function in recaptcha.php
if (!$resp->is_valid) {
switch($resp->error){
default:
$resp->error = JText::_('CAPTCHA_ERROR_UNKNOWN');
break;
case 'invalid-site-public-key':
$resp->error = JText::_('CAPTCHA_ERROR_INVALIDPUBLICKEY');
break;
case 'invalid-site-private-key':
$resp->error = JText::_('CAPTCHA_ERROR_INVALIDPRIVATEKEY');
break;
case 'invalid-request-cookie':
$resp->error = JText::_('CAPTCHA_ERROR_INVALIDREQUESTCOOKIE');
break;
case 'incorrect-captcha-sol':
$resp->error = JText::_('CAPTCHA_ERROR_INCORRECTSOLUTION');
break;
case 'verify-params-incorrect':
$resp->error = JText::_('CAPTCHA_ERROR_INCORRECTPARAMETERS');
break;
case 'invalid-referrer':
$resp->error = JText::_('CAPTCHA_ERROR_INVALIDREFERRER');
break;
case 'recaptcha-not-reachable':
$resp->error = JText::_('CAPTCHA_ERROR_UNREACHABLERECAPTCHA');
break;
}
2) Language File
Added the following strings.
CAPTCHA_ERROR_UNKNOWN="Anti-bot Validation - Unknown error"
CAPTCHA_ERROR_INVALIDPUBLICKEY="ReCaptcha couldn't verify the public key"
CAPTCHA_ERROR_INVALIDPRIVATEKEY="ReCaptcha couldn't verify the private key"
CAPTCHA_ERROR_INVALIDREQUESTCOOKIE="The challenge parameter of the verify script was incorrect"
CAPTCHA_ERROR_INCORRECTSOLUTION="The CAPTCHA solution was incorrect"
CAPTCHA_ERROR_INCORRECTPARAMETERS="The parameters were incorrect, make sure you are passing all the required parameters"
CAPTCHA_ERROR_INVALIDREFERRER="Invalid referer, reCAPTCHA API keys are tied to a specific domain name for security reasons"
CAPTCHA_ERROR_UNREACHABLERECAPTCHA="We couldn't contact the reCAPTCHA server to verify your answer. Please try again."
Note that only the 'incorrect-captcha-sol' case has been tested.
Hope this helps.
Take care!
Please Log in or Create an account to join the conversation.
11 years 10 months ago #181670
by nicolas
Replied by nicolas on topic ReCaptcha Errors Not Translated
Hi,
Thank you ! We've updated the plugin with the translations.
Thank you ! We've updated the plugin with the translations.
The following user(s) said Thank You: Ed_Hika
Please Log in or Create an account to join the conversation.
Time to create page: 0.188 seconds