You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add ability to set the language of the ReCaptcha widget (#56)
* Detect locale and pass it to google
* Update documentation, and try a whole different approach.
* Remove unused import
* Adjust composer to allow builds to work.
* Adjust composer correctly to allow builds to work.
* fix tests
Co-authored-by: Marc Runkel <[email protected]>
Co-authored-by: karser <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,13 +92,15 @@ class TaskType extends AbstractType
92
92
'constraints' => new Recaptcha3(),
93
93
'action_name' => 'homepage',
94
94
'script_nonce_csp' => $nonceCSP,
95
+
'locale' => 'de',
95
96
]);
96
97
}
97
98
}
98
99
```
99
100
Notes:
100
101
- The `action_name` parameter is [reCAPTCHA v3 action](https://developers.google.com/recaptcha/docs/v3#actions) which identifies the submission of this particular form in the Google reCAPTCHA dashboard, and confirming it is as expected in the backend is a recommended extra security step.
101
102
- The `script_nonce_csp` parameter is optional. You must use the same nonce as in your Content-Security Policy header.
103
+
- The `locale` parameter is optional. It defaults to English and controls the language on the reCaptcha widget.
102
104
103
105
### How to use reCAPTCHA globally (meaning even in China):
104
106
@@ -113,7 +115,10 @@ karser_recaptcha3:
113
115
114
116
### How can I set the captcha language for different locales?
115
117
116
-
You should install the [Symfony Translation component](https://symfony.com/doc/current/translation.html).
118
+
You can control the language in the small widget displayed by setting the locale in the options above.
119
+
120
+
To change the error messages, you should install the [Symfony Translation component](https://symfony.com/doc/current/translation.html).
121
+
117
122
Then replace the validation text with the translation keys for the message and messageMissingValue options:
0 commit comments