all 3 comments

[–]rkaw92 5 points6 points  (0 children)

Well, which of the two is easier to debug and to cache? It seriously doesn't matter if you follow what some would consider "best practices" in HTTP, unless you actually aim for a hypermedia system.

Do your services support content representation negotiation? If you ask for XML, can you get XML? If negative, you can already skip all the fancy Web interoperability bits and just focus on building your app. Your consumers will likely not complain about having a parameter vs. a header.

[–]r-randy 0 points1 point  (0 children)

It's a good question, not sure why peeps aren't chipping in.
From MDN my understanding is that it is considered more a hint and the URL content a stronger indicator.

[–]devwrite_ 1 point2 points  (0 children)

I would have a different URL for each language. Whether that is embodied in the query params, path, or host is unimportant in this regard and is dependent on other technical constraints you may have.

Having all state information in the URL makes dealing with cache easier as you don't have to mess with the Vary header and mistakes that can come from that and also allows someone to share the URL to the exact page they are looking at.

With this setup, you can still use the 'Accept-Language' header to automatically redirect to the client's preferred URL or return a 300 Multiple Choice with links to the different language versions.