WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#34908 closed enhancement (fixed)

Merge similar strings in REST API deprecated function/argument handlers

Reported by: SergeyBiryukov Owned by: rachelbaker
Milestone: 4.5 Priority: normal
Severity: normal Version:
Component: REST API Keywords: has-patch commit
Focuses: docs Cc:
PR Number:

Description

In rest_handle_deprecated_function(): '%1$s (since %2$s; use %3$s instead)'.
In rest_handle_deprecated_argument(): '%1$s (since %2$s; %3$s)'.

Unless I'm missing something, the latter could use the first string too.

Attachments (2)

34908.patch (1.6 KB) - added by ocean90 4 years ago.
34908.1.patch (1.6 KB) - added by rachelbaker 4 years ago.
updated translator comment

Download all attachments as: .zip

Change History (8)

#1 follow-up: @rmccue
4 years ago

For _deprecated_function, the arguments are $file, $version, $replacement; for _deprecated_argument, they're instead $function, $version, $message. We have the different strings here because functions typically only have a replacement function string, whereas arguments have a sentence explaining it.

@ocean90
4 years ago

#2 @ocean90
4 years ago

  • Focuses docs added
  • Keywords has-patch added; needs-patch good-first-bug removed
  • Milestone changed from Awaiting Review to 4.5
  • Type changed from defect (bug) to enhancement

34908.patch improves the docs and renames the third argument of rest_handle_deprecated_argument() to $message.

#3 in reply to: ↑ 1 @SergeyBiryukov
4 years ago

34908.patch looks good, but the translator comment should be updated as well.

I was confused by "3: new argument name" when translating the string.

@rachelbaker
4 years ago

updated translator comment

#4 @rachelbaker
4 years ago

I updated the translation comment within rest_handle_deprecated_argument() for the $message argument in 34908.1.patch. @ocean90 can you review?

#5 @SergeyBiryukov
4 years ago

  • Keywords commit added
  • Owner set to rachelbaker
  • Status changed from new to assigned

Looks good.

#6 @rachelbaker
4 years ago

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

In 35845:

Docs: Better param descriptions and fix incorrect param name within REST API deprecated functions

rest_handle_deprecated_function: you get better parameter descriptions.
rest_handle_deprecated_argument: you get a corrected parameter name ($replacement->$message), appropriate i18n translation hints, and better parameter descriptions.

Props ocean90.
Fixes #34908

Note: See TracTickets for help on using tickets.