Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#34619 closed defect (bug) (fixed)

Avoid using HTML tags in translation strings (wp-admin/includes/upgrade.php)

Reported by: ramiy Owned by: SergeyBiryukov
Priority: normal Milestone: 4.4
Component: I18N Version:
Severity: normal Keywords: has-patch commit
Cc: Focuses:

Description

Found a wrong use of str_replace() in translations strings. We should use sprintf() instead.

See the attached patch fixing this issue.

Attachments (3)

34619.patch​ (1.1 KB ) - added by ramiy 11 years ago.
34619.2.patch​ (1.1 KB ) - added by ramiy 11 years ago.
34619.3.patch​ (2.2 KB ) - added by SergeyBiryukov 11 years ago.

Download all attachments as: .zip

Change History (12)

#1 @ramiy
11 years ago

The second patch better - this way we avoid using HTML tags in the translation strings.

#2 @ramiy
11 years ago

  • Summary Use sprintf() instead of str_replace() in translations strings → Avoid using HTML tags in translation strings (wp-admin/includes/upgrade.php)

#3 @ramiy
11 years ago

  • Keywords has-patch added

#4 follow-up: @SergeyBiryukov
11 years ago

The same string is also used in tags/4.3.1/src/wp-admin/includes/schema.php#L977​.

It's a site option used for newly created sites in Multisite. We can't remove str_replace() here, it would still be needed for back-compat with the stored text.

#5 in reply to: ↑ 4 ; follow-ups: @ramiy
11 years ago

Can we use sprintf() strings in both places?

#6 in reply to: ↑ 5 @SergeyBiryukov
11 years ago

Replying to ramiy:

Can we use sprintf() strings in both places?

Haven't tested yet, but I think it was done this way because network_home_url() or get_current_site() is not available yet when populate_network() run for the first time.

#7 @ramiy
11 years ago

OK, I didn't know that. I guess you can close this ticket.

#8 in reply to: ↑ 5 @SergeyBiryukov
11 years ago

  • Keywords commit added
  • Milestone Awaiting Review → 4.4

Replying to ramiy:

Can we use sprintf() strings in both places?

On second thought, I think 34619.3.patch​ might work.

We still need str_replace() for back-compat, but at least the string would now be correct.

#9 @SergeyBiryukov
11 years ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → closed

In 35614:

Remove non-translatable HTML code from the first post content in populate_network() and wp_install_defaults().

Add translator comment.

Props ramiy.
Fixes #34619.

Note: See TracTickets for help on using tickets.