dozoisch/react-google-recaptcha

Set window.recaptchaOptions.lang dynamically after creating the store

Open

#67 geöffnet am 21. Dez. 2017

Auf GitHub ansehen
 (19 Kommentare) (2 Reaktionen) (0 zugewiesene Personen)JavaScript (148 Forks)github user discovery
help wanted

Repository-Metriken

Stars
 (1.081 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

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