The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Update hidden field with visitor language

Labels

This Discussion is public

Notifications

Hello,

I can't find a solution to automatically add a language code (en/fr/es, etc.) into a hidden field value based on the visitor browser language (or if not possible based on the URI).

Anny suggestions?

Thanks,

Frederic

I don't know that you can do that. Just because a person is in a specific location doesn't mean that they speak the language. What happens if a visitor is from one country and visiting another?

Maybe this will give you some insight. https://medium.com/@adeyinkaadegbenro/how-to-detect-the-location-of-your-websites-visitor-using-javascript-92f9e91c095f

Hello,

In fact we just want to know their language, the country is not important for us.

Any clue how to add the browser language or add it based on the page url?

Thanks,

Frederic

You can try this Javascript:

var language = window.navigator.userLanguage || window.navigator.language;

As I'm not a programmer, were do I add it so that it is added to the hidden field value?

Thanks!

 

Frederic

Discussion closed.