Make WordPress Core

Opened 11 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 Owned by:
Priority: normal Milestone: 4.5
Component: I18N Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

See the attached patch.

Attachments (2)

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

Download all attachments as: .zip

Change History (6)

@ramiy
11 years ago

#1 @ramiy
11 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
11 years ago

#2 @ramiy
11 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 Awaiting Review → 4.5
  • Resolution → fixed
  • Status new → closed

Fixed in [36794].

Note: See TracTickets for help on using tickets.