Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#36014 closed defect (bug) (fixed)

Move the aria-label text into a separate translation string

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

Description

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 string:

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

The text inside aria-label attribute was replaced with a %2$s placeholder.

This way the translation string is shorter and easier to translate.

BTW, in other string translations we do the same.

Attachments (2)

36014.patch (1.5 KB) - added by ramiy 9 years ago.
36014.2.patch (1.5 KB) - added by ramiy 9 years ago.

Download all attachments as: .zip

Change History (10)

@ramiy
9 years ago

#1 @ramiy
9 years ago

The new code:

sprintf(
	__( '<a href="%1$s" aria-label="%2$s">Logged in as %3$s</a>. <a href="%4$s">Log out?</a>' ),
	get_edit_user_link(),
	sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ),
	$user_identity,
	wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) )
)

#2 @ramiy
9 years ago

  • Keywords has-patch added

Related: #36013

@ramiy
9 years ago

#3 @ramiy
9 years ago

In the second patch I added esc_attr() to the aria-label text.

#4 @ramiy
9 years ago

The new code:

sprintf(
	__( '<a href="%1$s" aria-label="%2$s">Logged in as %3$s</a>. <a href="%4$s">Log out?</a>' ),
	get_edit_user_link(),
	esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ),
	$user_identity,
	wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) )
)

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


9 years ago

#6 @SergeyBiryukov
9 years ago

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

In 36794:

I18N: Move the aria-label text in comment_form() to a separate string for easier translation.

Add translator comments.

Props ramiy.
Fixes #36014.

#7 @SergeyBiryukov
9 years ago

  • Milestone changed from Awaiting Review to 4.5

#8 @ramiy
9 years ago

Related: #36048

Note: See TracTickets for help on using tickets.