#38857 closed defect (bug) (fixed)
REST API: Merge similar translation strings
Reported by: | ramiy | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | I18N | Keywords: | has-patch commit |
Focuses: | rest-api | Cc: |
Description
In the new Rest API, there are 3 places where we check if the current_user_can()
edit posts/terms/users.
We have two permission error messages:
- Sorry, you are not allowed to edit resource.
- Sorry, you are not allowed to manage this resource.
Thy can be merged into one strings:
- Sorry, you are not allowed to edit this resource.
Related: #38808
Attachments (3)
Change History (17)
#3
@
8 years ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
#6
follow-up:
↓ 8
@
8 years ago
- Keywords commit added
- Resolution fixed deleted
- Status changed from closed to reopened
Going to reopen, as there are still some inconsistencies in REST API strings.
Some messages refer to specific resource types, like posts or comments, others refer to a generic "resource". Here's a rest_forbidden_context
string from each endpoint:
class-wp-rest-comments-controller.php
:- "Sorry, you are not allowed to view comments with edit context."
class-wp-rest-post-types-controller.php
:- "Sorry, you are not allowed to edit this resource."
class-wp-rest-posts-controller.php
:- "Sorry, you are not allowed to edit posts in this post type."
- "Sorry, you are not allowed to edit this post."
class-wp-rest-taxonomies-controller.php
:- "Sorry, you are not allowed to edit this resource."
class-wp-rest-terms-controller.php
:- "Sorry, you are not allowed to view this resource with edit context."
class-wp-rest-users-controller.php
:- "Sorry, you are not allowed to view this resource with edit context."
38857.2.patch brings some consistency. Note: it uses two strings that could probably be merged, but I've separated them for clarity, as they refer to different capabilities (edit_terms
and manage_terms
, respectively):
- "Sorry, you are not allowed to edit terms in this taxonomy."
- "Sorry, you are not allowed to manage terms in this taxonomy."
(Not sure what's the difference between those two capabilities though, they appear to be used somewhat interchangeably in core.)
On a related note, some of item schema description strings look weird in terms of translation, for example:
- "First name for the resource."
- "The nickname for the resource."
Is there a reason to a use a generic "resource" here (and in other classes) instead of "user"?
#8
in reply to:
↑ 6
@
8 years ago
Replying to SergeyBiryukov:
Some messages refer to specific resource types, like posts or comments, others refer to a generic "resource".
I noticed this too. Not sure if it is intentional. Any way, I like your patch, it clarifies the error messages.
In 39304: