Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#54658 closed defect (bug) (fixed)

Add context to "%1$s is deprecated" strings

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.0 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: Cc:

Description

In the _deprecated_*() functions family, there are some commonly used strings:

  • %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.
  • %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.

The problem is that these strings are used for several completely different entities: PHP functions, PHP file names, and WordPress hooks.

While the strings do have translator comments, it would also be helpful for translators to be able to differentiate these strings and say what exactly is deprecated: a function, a file name, or a hook.

Another option would be to make the original strings more explicit instead:

  • Function %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.
  • Function %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.
  • File %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.
  • File %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.
  • Hook %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.
  • Hook %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.

Attachments (2)

54658.diff (4.7 KB) - added by SergeyBiryukov 2 years ago.
54658.2.diff (7.6 KB) - added by SergeyBiryukov 2 years ago.

Download all attachments as: .zip

Change History (7)

@SergeyBiryukov
2 years ago

#1 @mukesh27
2 years ago

@SergeyBiryukov Looks good. It helps the translator a lot to understand what has deprecated a function, a file name, or a hook.

Patch looks good to me.

#2 in reply to: ↑ description @SergeyBiryukov
2 years ago

Thanks for reviewing!

Replying to SergeyBiryukov:

Another option would be to make the original strings more explicit instead

The more I think about it, the more I like this latter option, as it makes the original strings clearer, so here's a patch in that direction as well.

#3 @audrasjb
2 years ago

54658.2.diff really looks better to me. A more detailed information about what is the item is useful for everyone and not only polyglots :)

#4 @SergeyBiryukov
2 years ago

Thanks for the feedback! :)

#5 @SergeyBiryukov
2 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 52609:

General: Clarify the deprecation messages in the _deprecated_*() functions family.

This makes the strings easier to translate and provides more details about what exactly is deprecated: a PHP function, a file name, or a WordPress hook.

The changes apply to:

  • _deprecated_function()
  • _deprecated_constructor()
  • _deprecated_file()
  • _deprecated_argument()
  • _deprecated_hook()
  • _doing_it_wrong()

Follow-up to [6514], [7884], [12536], [12584], [16939], [16942], [16945], [24439], [24723], [32989], [37861], [39315].

Props mukesh27, audrasjb, SergeyBiryukov.
Fixes #54658.

Note: See TracTickets for help on using tickets.