Opened 4 years ago
Closed 4 years ago
#51727 closed defect (bug) (fixed)
REST:API One of the new strings should use _n()
Reported by: | tobifjellner | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.6 | Priority: | normal |
Severity: | normal | Version: | 5.6 |
Component: | REST API | Keywords: | has-patch |
Focuses: | Cc: |
Description
New string located in https://build.trac.wordpress.org/browser/trunk/wp-includes/rest-api.php?marks=2090#L2090
%1$s must contain at least %2$s properties.
Since %2$s is a number, this string should enable correct plural handling, using _n()
Attachments (1)
Change History (7)
#2
@
4 years ago
Thanks for catching that @tobifjellner! I think the PHPCS of the patch is incorrect though, @audrasjb.
#4
@
4 years ago
Some notes on the patch:
- Translator comment should be directly above the line with the
_n()
call, not earlier. _n()
should receive the number as is,number_format_i18n()
is only needed in the second instance.- As noted above, needs some PHPCS corrections.
Looks good otherwise :) This can all be corrected on commit.
#5
@
4 years ago
These two strings also need the same adjustment:
if ( isset( $args['minItems'] ) && count( $value ) < $args['minItems'] ) { /* translators: 1: Parameter, 2: Number. */ return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must contain at least %2$s items.' ), $param, number_format_i18n( $args['minItems'] ) ) ); } if ( isset( $args['maxItems'] ) && count( $value ) > $args['maxItems'] ) { /* translators: 1: Parameter, 2: Number. */ return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must contain at most %2$s items.' ), $param, number_format_i18n( $args['maxItems'] ) ) ); }
Note: See
TracTickets for help on using
tickets.
REST API: replace () with _n()