WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#36014 closed defect (bug) (fixed)

Move the aria-label text into a separate translation string

Reported by: ramiy Owned by: 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 4 years ago.
36014.2.patch (1.5 KB) - added by ramiy 4 years ago.

Download all attachments as: .zip

Change History (10)

@ramiy
4 years ago

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

  • Keywords has-patch added

Related: #36013

@ramiy
4 years ago

#3 @ramiy
4 years ago

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

#4 @ramiy
4 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.


4 years ago

#6 @SergeyBiryukov
4 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
4 years ago

  • Milestone changed from Awaiting Review to 4.5

#8 @ramiy
4 years ago

Related: #36048

Note: See TracTickets for help on using tickets.