Hi there. Do you know if Umbraco has a way to pass the request header accept-language with the culture given for the current page?
I have a site that passes different culture from different web browsers (based on browser settings). I do not want this, I want it to come from Umbraco or my custom code.
s
Sebastiaan
09/13/2023, 3:26 PM
I have no good answer at the moment but.. if I'm setting my browser to a specific culture, I really (REALLY) want websites to honor that. I am from Holland, but live in Denmark. However, in either case I've set my browser to English because I really don't want to read either Dutch or Danish.
I get sad when people override my language preferences. 🥲
The problem is that most users have no idea and we want to present the language that is set for the Umbraco page/site
We have multiple sites with different languages in the same project so we have to set this somewhere. It is strange if you have a page with content in Swedish and dates come back formatted in english.
Josef Henryson
09/13/2023, 3:37 PM
But maybe the custom controller may do the trick. I was hoping there was some easier config somewhere that I did not know about.
Thanks. I was about to try to add culture / header in the startup conf but realized we don't know which site is visited by then.
The solution above seems to require setting cookies in a controller action. Which means I have to override Umbracos controller.
Seems like a lot of work for something that "feels quite basic".
Anyway, I ended up setting request header in my API calls where I fetch data by javascript. It works for that. But the CookieBot text is still in the wrong language since it is based on the current page headers. But I leave that for now. Maybe someone from Umbraco reads this and get inspired to add request header from the current site culture, at least Content-Language if they don't want to override the browser / user setting with Accept-Language 😄 😉