[wp-trac] [WordPress Trac] #44758: The REST API is not respecting the user's locale properly.

WordPress Trac noreply at wordpress.org
Mon Aug 20 16:41:00 UTC 2018


#44758: The REST API is not respecting the user's locale properly.
-------------------------+------------------------------
 Reporter:  youknowriad  |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  REST API     |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by mnelson4):

 Ah! Important insight, thanks @TimothyBlynJacobs. And that would be a
 problem because we'd like the default to be to the site's default
 language, whereas if API clients are automatically sending the `Accept-
 Language` header which specifies which language to use, then they'll
 default to seeing the site in their language instead of the site's
 language.

 So in order to use the `Accept-Language` header in REST API requests, we
 should have been using it in normal web requests too. (Because then a
 French visitor would visit a site that's normally English, and instead see
 a French version, and when their browser makes requests to the REST API,
 the responses will also be in French; whereas if only the REST API uses
 `Accept-Language`, but normal web requests don't, then the page would load
 in English, but content loaded over the REST API would be in French).

 Ok, so it seems if WordPress were to support `Accept-Language` header, it
 would be a separate initiative that would probably include using it in
 normal web requests too.

 So, a `_locale` header with options of `site` or `user` would fit better
 into the WordPress way.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44758#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list