Answer the question
In order to leave comments, you need to log in
Place locale in header or URL?
I ran into the issue again, earlier I decided to sculpt the locale in the URL, but I noticed that then it is necessary to localize, sculpt the locale in 99% of API links. Why?
Trite validation and server response, not just localized entities. For example links
host.com/ru-ru/api/v1/login
host.com/ru-ru/api/v1/register
host.com/ru-ru/api/v1/update/profile
Since you can store the locale of the user in the session, it may be tempting to use the same URL to display a resource in different languages based on the user's locale. For example, www.example.com/contact could show content in English for one user and French for another user. Unfortunately, this violates a fundamental rule of the Web: that a particular URL returns the same resource regardless of the user. To further muddy the problem, which version of the content would be indexed by search engines?
A better policy is to include the locale in the URL using the special _locale parameter:
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question