dozoisch / dozoisch/react-google-recaptcha
Set window.recaptchaOptions.lang dynamically after creating the store
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 148
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to set the recaptcha language dynamically in my application. Looking at the documentation here https://github.com/dozoisch/react-google-recaptcha
In order to translate the reCaptcha widget, you should create a global variable configuring the desired language. If you don't provide it, reCaptcha will pick up the user's interface language.
window.recaptchaOptions = {
lang: 'fr'
}
This works if I set the global window.recaptchaOptions object in root app.js file
The issue that I'm trying to resolve is setting the window.recaptchaOptions inside the index.js after creating the store so I can access the locale dynamically.
Investigating the requests, it looks like the google recaptcha__fr script is pulled in only if I set the global window.recaptchaOptions in the root App. This doesn't allow me to access the store.
Any thoughts on how I can fix this so I can set the window.recaptchaOptions in index.js after creating the store?
Thanks
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by comparing the root app.js setup with the requested index.js setup and trace when react-google-recaptcha loads the Google reCAPTCHA script. Determine whether the locale can be supplied after the store is created without changing the documented global configuration. Done means the dynamically selected locale loads the corresponding widget language and existing behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100