[wp-trac] [WordPress Trac] #35668: Avoid using HTML tags in translation strings (wp-admin/credits.php)
WordPress Trac
noreply at wordpress.org
Sat Jan 30 22:39:02 UTC 2016
#35668: Avoid using HTML tags in translation strings (wp-admin/credits.php)
--------------------------+------------------------------
Reporter: ramiy | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: I18N | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+------------------------------
Comment (by ramiy):
I tested several options for this.
Original string:
{{{
<p class="clear"><?php
/* translators: %s: https://make.wordpress.org/ */
printf( __( 'Want to see your name in lights on this page? <a
href="%s">Get involved in WordPress</a>.' ),
__( 'https://make.wordpress.org/' )
);
?></p>
}}}
Option 1:
{{{
<p class="clear"><?php
printf(
/* translators: %s: get involved link */
__( 'Want to see your name in lights on this page? %s' ),
sprintf(
/* translators: %s: https://make.wordpress.org/ */
__( '<a href="%s">Get involved in WordPress</a>.'
),
__( 'https://make.wordpress.org/' )
)
);
?></p>
}}}
Option 2:
{{{
<p class="clear"><?php
printf(
/* translators: %s: get involved link */
__( 'Want to see your name in lights on this page? %s' ),
' <a href="' . __( 'https://make.wordpress.org/' ) . '">'
. __( 'Get involved in WordPress' ) . '</a>'
)
);
?></p>
}}}
Option 3:
{{{
<p class="clear">
<?php _e( 'Want to see your name in lights on this page?' ); ?>
<a href="<?php echo esc_url( 'https://make.wordpress.org/' );
?>"><?php _e( 'Get involved in WordPress' ); ?></a>
</p>
}}}
I prefer the last one, it has no '''%s''' placeholders.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35668#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list