Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#35729 closed defect (bug) (fixed)

Avoid using HTML tags in translation strings (wp-includes/comment-template.php)

Reported by: ramiy's profile ramiy Owned by:
Milestone: 4.5 Priority: normal
Severity: normal Version:
Component: I18N Keywords: has-patch
Focuses: Cc:

Description

See the attached patch.

Attachments (2)

35729.patch (1.5 KB) - added by ramiy 10 years ago.
35729.2.patch (2.1 KB) - added by ramiy 10 years ago.

Download all attachments as: .zip

Change History (6)

@ramiy
10 years ago

#1 @ramiy
10 years ago

  • Keywords has-patch added

This is a bit tricky.

The original translation string is: <a href="%1$s" aria-label="Logged in as %2$s. Edit your profile.">Logged in as %2$s</a>. <a href="%3$s">Log out?</a>


The ticket goal to to create three separate translation strings without the HTML tags:

  1. Logged in as %s. Edit your profile.
  1. Logged in as %s.
  1. Log out?

The initial patch is splitting the long string only into two translation strings, and removes the HTML <a> tag only from the second string.

The two new strings are:

  1. <a href="%1$s" aria-label="Logged in as %2$s. Edit your profile.">Logged in as %2$s</a>.
  1. Log out?

@ramiy
10 years ago

#2 @ramiy
10 years ago

Ok, It's done!


Old string:

  • <a href="%1$s" aria-label="Logged in as %2$s. Edit your profile.">Logged in as %2$s</a>. <a href="%3$s">Log out?</a>

New strings:

  • Logged in as %s. Edit your profile.
  • Logged in as %s
  • Log out?

No HTML tags, much easier to translate.

#3 @swissspidy
10 years ago

__( '%s.' ) feels wrong, especially without a translator comment. Can we get rid of that somehow?

#4 @ocean90
10 years ago

  • Milestone changed from Awaiting Review to 4.5
  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [36794].

Note: See TracTickets for help on using tickets.