Forum Academy Marketplace Showcase Pricing Features

How to use HTTP header Accept-Language to preset lang on a landing page?


I just started to explore for one of the applications I’m planning to build. One of the important elements of that app is the ability to present the content in the right language to anonymous visitors already on the landing page. (I will give them the option to change the language later, but would like to have the first page opened in their browser’s preferred language).

I see the announcement of the multilingual support (here), however, it states, that to make a language selection for the incoming traffic you need to use the URL parameter “lang” - however, I have to use the exact same URL for all visitors, and would need to make that determination on the server side.

Is it somehow possible to use the HTTP Accept-Language header to pre-select the language for the user?
For example, by auto-creating the lang parameter based on the first language listed in the header?


1 Like


I stumbled over this old post when I searched for a solution to read the Accept-Language HTTP header in order to pre-set the language of customers who did not register or log in, yet.

My project is pan-European, so I wandered if bubble ever considered making this interesting browser setting available in the UI.

Is there a simple way to access http headers?