Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
You are inquiring about how to apply language changes to reCAPTCHA and Google Maps when the language change button is pressed, rather than relying on the browser's language settings.
Solution:
For reCAPTCHA, you can manually set the language by adding the "hl" parameter in the reCAPTCHA script URL. Here is an example:

<script src="https://www.google.com/recaptcha/api.js?hl=fr"></script>

Modify the parameter based on the active language using WPML hooks or JavaScript.
Similarly, for Google Maps, to force a specific language, add the "language" parameter to the Google Maps script URL. For example:

<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&language=fr"></script>

You can dynamically change this parameter based on the current WPML language.
For more information on WPML Coding API, visit https://wpml.org/documentation/support/wpml-coding-api/.

If this solution does not apply to your case, or if it seems outdated, we recommend opening a new support ticket. Also, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. For further assistance, please contact us through the WPML support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Andrey 7 months, 2 weeks ago.

Assisted by: Andrey.

Author Posts
May 17, 2024 at 10:38 am #15638896

michaelD-80

Hello,
A few days ago, I inquired about reCAPTCHA and Google Maps translation. I received a response that it would be automatically translated depending on the browser environment. What I'm curious about is if there is a way to apply it so that it is applied when the language change button is pressed.

Please help!

스크린샷 2024-05-17 오후 7.35.20.png
May 17, 2024 at 12:17 pm #15639581

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

Thank you for reaching out to WPML support.

Handling reCAPTCHA and Google Maps language settings is not simple. Both rely on the browser’s language settings. To ensure it displays the desired language, make sure your browser is set to the correct language.

In scenarios where custom programming is required, it goes beyond the support we can provide, and I'm afraid this is the case. As a tip, you can try to manually set the language for reCAPTCHA by adding the "hl" parameter in the reCAPTCHA script URL. For example:

<script src="<em><u>hidden link</u></em>"></script>

You can modify the parameter based on the active language using WPML hooks or JavaScript.

Similarly, for Google Maps API, to force a specific language, you need to add the "language" parameter to the Google Maps script URL. For example:

<script src="<em><u>hidden link</u></em>"></script>

You can dynamically change the language parameter based on the current WPML language.

For more information on WPML Coding API, you can visit https://wpml.org/documentation/support/wpml-coding-api/.