WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#36013 closed defect (bug) (fixed)

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

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

Description

Old string:

  • <span>%1$s, %2$s</span> <a href="%3$s" aria-label="%5$s">%4$s</a>

New string:

  • <span>%1$s, %2$s</span> %3$s

I replaced <a href="%3$s" aria-label="%5$s">%4$s</a> with %3$s, moving the HTML out from the translation string.

(See the attached patch)

Attachments (5)

36013.patch (1.3 KB) - added by ramiy 4 years ago.
36013.2.patch (1.2 KB) - added by SergeyBiryukov 4 years ago.
36013.png (69.5 KB) - added by ramiy 4 years ago.
36013rtl.png (54.8 KB) - added by ramiy 4 years ago.
36013.3.patch (1.3 KB) - added by ramiy 4 years ago.

Download all attachments as: .zip

Change History (12)

@ramiy
4 years ago

#1 @ramiy
4 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
4 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 4.5

@ramiy I think we can move <span> tags out of the string too, see 36013.2.patch.

#3 follow-up: @ramiy
4 years ago

Nice, but this way the translator can't present the post title before the date&time.

@ramiy
4 years ago

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

Replying to ramiy:

Nice, but this way the translator can't present the post title before the date&time.

@ocean90, could you take a look if any locales currently do that? It's separated visually, so I don't think there are any (checked he_IL too to make sure it's not an RTL issue).

#5 @ramiy
4 years ago

@SergeyBiryukov,

You can commit your patch,

The span added display: inline-block; and min-width: 150px;.

The date is always before the post title.

@ramiy
4 years ago

This ticket was mentioned in Slack in #core-i18n by ramiy. View the logs.


4 years ago

@ramiy
4 years ago

#7 @SergeyBiryukov
4 years ago

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

In 36793:

I18N: Remove HTML tags from translatable string in wp-admin/includes/dashboard.php.

Props ramiy, SergeyBiryukov.
Fixes #36013.

Note: See TracTickets for help on using tickets.