Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#38528 closed enhancement (fixed)

Add 'locale' as an attribute on the User Resource

Reported by: danielbachhuber's profile danielbachhuber Owned by: joehoyle's profile joehoyle
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: REST API Keywords: has-unit-tests needs-patch
Focuses: Cc:

Description

Now that users can pick their own locales, this data should be exposed through the REST API.

Attachments (3)

38528.patch (3.0 KB) - added by ocean90 8 years ago.
38528.2.diff (4.7 KB) - added by joehoyle 8 years ago.
38528.3.diff (1.1 KB) - added by ocean90 8 years ago.

Download all attachments as: .zip

Change History (11)

@ocean90
8 years ago

#1 @ocean90
8 years ago

  • Keywords has-patch added; needs-patch removed

First pass in 38528.patch.

#2 @joehoyle
8 years ago

  • Milestone changed from Awaiting Review to 4.7

#3 @joehoyle
8 years ago

  • Owner set to joehoyle
  • Status changed from new to assigned

@joehoyle
8 years ago

#4 @joehoyle
8 years ago

  • Keywords has-unit-tests added; needs-unit-tests removed

New patch with support for updating the user's local. Also, I changed to use an ENUM of available languages, so this means there's no need for sanitization as only values in get_available_languages() are then allowed.

Added a couple more tests too.

#5 @rmccue
8 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 39090:

REST API: Add locale to user resource.

Props ocean90, joehoyle.
Fixes #38528.

@ocean90
8 years ago

#6 @ocean90
8 years ago

  • Keywords needs-patch added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

get_available_languages() doesn't return en_US, see 38528.3.diff for a failing test. I'm currently not sure if an empty string (to force using get_locale() in get_user_locale()) should be supported as well.

cc: @swissspidy

This ticket was mentioned in Slack in #core-restapi by joehoyle. View the logs.


8 years ago

#8 @joehoyle
8 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 39096:

REST API: Add en_US to the locales enum.

Props ocean90.
Fixes #38528.

Note: See TracTickets for help on using tickets.