Make WordPress Core

Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#55405 closed defect (bug) (fixed)

i18n: Use a placeholder instead of 'Template' in a message in WP_Theme::__construct()

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

Description

There is an error message in WP_Theme::__construct():

Template is missing. Standalone themes need to have a %1$s or %2$s template file. <a href="%3$s">Child themes</a> need to have a Template header in the %4$s stylesheet.

Since the Template word here is literal and is not meant to be translated, it should be moved out of the translatable string and replaced with a placeholder, similar to index.php or style.css in the same string.

When working on a patch, please note that the translator comment above the string should be updated too.

Attachments (2)

55405.diff (1.1 KB) - added by azouamauriac 2 years ago.
55405.2.diff (1.2 KB) - added by SergeyBiryukov 2 years ago.

Download all attachments as: .zip

Change History (10)

This ticket was mentioned in PR #2423 on WordPress/wordpress-develop by kapilpaul.


3 years ago
#1

  • Keywords has-patch added; needs-patch removed

trac-55405: i18n: Use a placeholder instead of 'Template' in a message in WP_Theme::construct()

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

This ticket was mentioned in Slack in #core by sergey. View the logs.


2 years ago

SergeyBiryukov commented on PR #2423:


2 years ago
#3

Thanks for the PR!

It looks like I forgot to mention on the ticket that only the latest instance of Template should be replaced here, specifically in this sentence:

<a href="%3$s">Child themes</a> need to have a Template header in the %4$s stylesheet.

Other instances of the word are fine as is and do need to remain translatable.

@azouamauriac
2 years ago

#4 @SergeyBiryukov
2 years ago

  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

#5 follow-up: @SergeyBiryukov
2 years ago

Thanks for the refresh! It looks like 55405.diff is still not quite correct, as it changes the first sentence instead of the one mentioned in comment:3.

55405.2.diff is what I meant here :)

#6 @SergeyBiryukov
2 years ago

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

In 53190:

I18N: Move code out of a translatable string in WP_Theme::__construct().

Props kapilpaul, azouamauriac, SergeyBiryukov.
Fixes #55405.

#8 in reply to: ↑ 5 @azouamauriac
2 years ago

Replying to SergeyBiryukov:

Thanks for the refresh! It looks like 55405.diff is still not quite correct, as it changes the first sentence instead of the one mentioned in comment:3.

55405.2.diff is what I meant here :)

Ooooh, sorry for the misunderstanding... I'll catch up next time.

Thanks to handle this.

Note: See TracTickets for help on using tickets.