Skip to content

Commit

Permalink
Add a11y translator comments
Browse files Browse the repository at this point in the history
  • Loading branch information
igorschoester committed Sep 28, 2023
1 parent 4e8b370 commit 04f0da1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions duplicate-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ function duplicate_post_plugin_actions( $actions ) {
'settings' => sprintf(
'<a href="%1$s" %2$s>%3$s</a>',
menu_page_url( 'duplicatepost', false ),
/* translators: Hidden accessibility text. */
'aria-label="' . __( 'Settings for Duplicate Post', 'duplicate-post' ) . '"',
esc_html__( 'Settings', 'duplicate-post' )
),
Expand Down
8 changes: 6 additions & 2 deletions src/admin/views/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
<form id="duplicate_post_settings_form" method="post" action="options.php" style="clear: both">
<?php \settings_fields( 'duplicate_post_group' ); ?>

<header role="tablist" aria-label="<?php \esc_attr_e( 'Settings sections', 'duplicate-post' ); ?>"
class="nav-tab-wrapper">
<header role="tablist" aria-label="
<?php
/* translators: Hidden accessibility text. */
\esc_attr_e( 'Settings sections', 'duplicate-post' );
?>
" class="nav-tab-wrapper">
<button
type="button"
role="tab"
Expand Down
6 changes: 3 additions & 3 deletions src/ui/row-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function add_clone_action_link( $actions, $post ) {

$actions['clone'] = '<a href="' . $this->link_builder->build_clone_link( $post->ID )
. '" aria-label="' . \esc_attr(
/* translators: %s: Post title. */
/* translators: Hidden accessibility text; %s: Post title. */
\sprintf( \__( 'Clone &#8220;%s&#8221;', 'duplicate-post' ), $title )
) . '">'
. \esc_html_x( 'Clone', 'verb', 'duplicate-post' ) . '</a>';
Expand All @@ -108,7 +108,7 @@ public function add_new_draft_action_link( $actions, $post ) {

$actions['edit_as_new_draft'] = '<a href="' . $this->link_builder->build_new_draft_link( $post->ID )
. '" aria-label="' . \esc_attr(
/* translators: %s: Post title. */
/* translators: Hidden accessibility text; %s: Post title. */
\sprintf( \__( 'New draft of &#8220;%s&#8221;', 'duplicate-post' ), $title )
) . '">'
. \esc_html__( 'New Draft', 'duplicate-post' )
Expand Down Expand Up @@ -139,7 +139,7 @@ public function add_rewrite_and_republish_action_link( $actions, $post ) {

$actions['rewrite'] = '<a href="' . $this->link_builder->build_rewrite_and_republish_link( $post->ID )
. '" aria-label="' . \esc_attr(
/* translators: %s: Post title. */
/* translators: Hidden accessibility text; %s: Post title. */
\sprintf( \__( 'Rewrite & Republish &#8220;%s&#8221;', 'duplicate-post' ), $title )
) . '">'
. \esc_html_x( 'Rewrite & Republish', 'verb', 'duplicate-post' ) . '</a>';
Expand Down
6 changes: 3 additions & 3 deletions src/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static function get_edit_or_view_link( $post ) {
return \sprintf(
'<a href="%s" aria-label="%s">%s</a>',
\esc_url( \get_edit_post_link( $post->ID ) ),
/* translators: %s: post title */
/* translators: Hidden accessibility text; %s: post title */
\esc_attr( \sprintf( \__( 'Edit &#8220;%s&#8221;', 'duplicate-post' ), $title ) ),
$title
);
Expand All @@ -130,7 +130,7 @@ public static function get_edit_or_view_link( $post ) {
return \sprintf(
'<a href="%s" rel="bookmark" aria-label="%s">%s</a>',
\esc_url( $preview_link ),
/* translators: %s: post title */
/* translators: Hidden accessibility text; %s: post title */
\esc_attr( \sprintf( \__( 'Preview &#8220;%s&#8221;', 'duplicate-post' ), $title ) ),
$title
);
Expand All @@ -140,7 +140,7 @@ public static function get_edit_or_view_link( $post ) {
return \sprintf(
'<a href="%s" rel="bookmark" aria-label="%s">%s</a>',
\esc_url( \get_permalink( $post->ID ) ),
/* translators: %s: post title */
/* translators: Hidden accessibility text; %s: post title */
\esc_attr( \sprintf( \__( 'View &#8220;%s&#8221;', 'duplicate-post' ), $title ) ),
$title
);
Expand Down

0 comments on commit 04f0da1

Please sign in to comment.