[wp-trac] [WordPress Trac] #44758: The REST API is not respecting the user's locale properly.
WordPress Trac
noreply at wordpress.org
Thu Aug 9 18:03:26 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):
First off, adding a `_locale` parameter, which would default to `site`,
but could also be set to `user` sounds useful.
Here's some additional food for thought though:
In slack @TimothyBlynJacobs brought up that there's a standard `Accept-
Language` header that might apply: https://developer.mozilla.org/en-
US/docs/Web/HTTP/Headers/Accept-Language.
So far we've really only used request headers for authentication, though,
which is why he suggested this be a query parameter. (BTW, even if it's a
query parameter, it could still be used for PUT and POST requests too).
The main downside to the `Acccept-Language` header is it's supposed to
receive a language string, whereas it would be slick if we could just
provide `user` as a value, meaning whatever language the user wanted.
I think being able to specify the user's selected language will be more
useful than being able to specify ANY arbitrary language, but I can see
folks wanting any arbitrary language too. (Eg, if you set the language
inside a mobile app, then you'd want to see everything in that language-
although in that case, it would probably be better to update the user's
locale, because it's doubtful they'd want to use a different language on
their mobile app than in the web interface).
IMO it would be good to use `Accept-Language`, but also permit the value
`user`, to mean "use whatever language the user has set" (and not setting
the `Accept-Language` header means use the site's language). But
@kadamwhite said in slack that felt weird. Other thoughts on using the
`Accept-Language` header? (And either sticking to the standard, or
slightly tweaking the standard to also support `user`?)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44758#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list