Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

localized DonateHelpPage recaptcha box #11450

Merged
merged 2 commits into from
Nov 21, 2023

Conversation

danielfmiranda
Copy link
Collaborator

@danielfmiranda danielfmiranda commented Nov 20, 2023

Description

Link to sample test page:
Related PRs/issues: #11448

This PR updates the src of the script <script src='https://www.google.com/recaptcha/enterprise.js?onload=gCaptchaReadyCallback&render=explicit&hl=en_US' nonce="{{ request.csp_nonce }}" async defer></script> to include hl={{ LANGUAGE_CODE }} instead of being hardcoded to en_US. That way the recaptcha box renders with the users active locale.

Screenshots

EN (English):
Screenshot 2023-11-20 at 3 38 41 PM

ES (Spanish):
Screenshot 2023-11-20 at 3 38 53 PM

DE (German):
Screenshot 2023-11-20 at 3 39 10 PM

FR (French):
Screenshot 2023-11-20 at 3 39 22 PM

fy-NL (Frisian):
Screenshot 2023-11-20 at 3 39 40 PM

NL (Dutch):
Screenshot 2023-11-20 at 3 39 54 PM

PL (Polish):
Screenshot 2023-11-20 at 3 40 08 PM

pt-BR (Portuguese (Brazil)):
Screenshot 2023-11-20 at 3 40 24 PM

SW (Swahili):
Screenshot 2023-11-20 at 3 40 38 PM

@danielfmiranda danielfmiranda changed the title localized recaptcha box localized DonateHelpPage recaptcha box Nov 20, 2023
Copy link
Collaborator

@mmmavis mmmavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @danielfmiranda ,

I'm wondering if FA supports all languages our site supports? If not, we will need to fallback to en so that the script file can be properly loaded (e.g., using our custom fa_locale_code tag)

@danielfmiranda
Copy link
Collaborator Author

Hi @mmmavis!! Thanks for the review 👍

The external script that this PR updates is actually not directly related to form assembly, but instead a google script that is used the render the recaptcha box.

Taking a look at the recaptcha docs here, it appears that they support all of the languages that we support, and after testing I can confirm they do. For example, the screenshots above show a localized recaptcha box for every language in our supported languages list.

Taking a look at the code for fa_locale_code, it appears that we would lose support for fy-NL and SW if we were to use that tag.

However, I do see the benefit in sharing one tag.

Do you think we should stick with LANGUAGE_CODE as recaptcha supports all languages that the foundation site does?
Or, should I switch it out for fa_locale_tag to reduce complication, with the catch that the recaptcha box would lose support for fy-NL and SW.

Thanks!

@mmmavis
Copy link
Collaborator

mmmavis commented Nov 21, 2023

@danielfmiranda ah apologies! From my quick review yesterday I didn't realize we were talking about a script from Google. Thank you for your detailed explanation! In that case I would say sticking to your current implementation (using LANGUAGE_CODE) 😃

Copy link
Collaborator

@mmmavis mmmavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @danielfmiranda !

@danielfmiranda danielfmiranda merged commit e276583 into main Nov 21, 2023
6 checks passed
@danielfmiranda danielfmiranda deleted the 11448-donate-help-recaptcha-localization branch November 21, 2023 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants