Make WordPress Core

Opened 2 months ago

Closed 2 months ago

Last modified 2 months ago

#60590 closed defect (bug) (fixed)

Function wp_remove_surrounding_empty_script_tags should use sprintf with placeholder

Reported by: swissspidy's profile swissspidy Owned by: kadamwhite's profile kadamwhite
Milestone: 6.5 Priority: normal
Severity: normal Version:
Component: Script Loader Keywords: good-first-bug has-patch commit
Focuses: Cc:

Description

The function wp_remove_surrounding_empty_script_tags() currently uses the following function call:

__( 'Function wp_remove_surrounding_empty_script_tags() used incorrectly in PHP.' )

wp_remove_surrounding_empty_script_tags() should not be translatable.

This should be changed to use sprintf with a placeholder and an accompanying translator comment.

Something like this:

sprintf(
        /* translators: %s: wp_remove_surrounding_empty_script_tags() */
        __( 'Function %s used incorrectly in PHP.' ),
        'wp_remove_surrounding_empty_script_tags()'
);

Change History (7)

This ticket was mentioned in PR #6167 on WordPress/wordpress-develop by naogify.


2 months ago
#1

  • Keywords has-patch added; needs-patch removed

I use sprint to prevent to translate "wp_remove_surrounding_empty_script_tags".

The detailed explanation is as follows, quoted from the track.

The function wp_remove_surrounding_empty_script_tags() currently uses the following function call:

( 'Function wp_remove_surrounding_empty_script_tags() used incorrectly in PHP.' )
wp_remove_surrounding_empty_script_tags() should not be translatable.

Trac ticket: https://core.trac.wordpress.org/ticket/60590

#2 @kadamwhite
2 months ago

  • Keywords commit added
  • Owner set to kadamwhite
  • Status changed from new to accepted

I have tested the patch from @naoki0h at WordCamp Kansai Contributor Day and it works as expected. After discussion with @kirasong I'm marking this for commit, since we're before the string freeze.

#3 @kadamwhite
2 months ago

  • Keywords i18n-change added

#4 @kadamwhite
2 months ago

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

In 57699:

Script Loader: Inject wp_remove_surrounding_empty_script_tags function name in returned error string using sprintf.

The name of this function should not be editable by the translator in the internationalized return error string.

Props naoki0h, swissspidy, kirasong.
Fixes #60590.

#5 @kadamwhite
2 months ago

(Note: after rereading the trac workflow keyword guide it seems the i18n-change keyword is intended for use after string freeze, so apologies in advance if this was not the right context to use that. Leaving it in place out of an abundance of caution.)

#7 @swissspidy
2 months ago

  • Keywords i18n-change removed
  • Milestone changed from 6.6 to 6.5
Note: See TracTickets for help on using tickets.