0

I have a basic dropdown menu where the user is able to select the language the website should appear in. My problem is not everyone understands "Select Language". So I was trying to find a method that allows to detect the language of the browser and serve an appropiate text accordingly.

For example if:

User Agent is in English

then:

"Select Language"

How do I do this with PHP or Javascript?

Daniels
  • 111
  • 1
  • 13

1 Answers1

0

On the server side in PHP, use the Accept-Language header to determine the browser's configured language. Details can be found in this answer.

Community
  • 1
  • 1
miken32
  • 42,008
  • 16
  • 111
  • 154