Skip to content

Commit

Permalink
Support 2024: i18n for homepage 'Get started' links
Browse files Browse the repository at this point in the history
Enables the slug for the welcome page to be translated, so that the 'Get started' links on the archive and homepage can be customized per locale.

Fixes https://meta.trac.wordpress.org/ticket/7821



git-svn-id: https://meta.svn.wordpress.org/sites/trunk@14172 74240141-8908-4e6f-9713-ba540dce6ec7
  • Loading branch information
Adam Wood authored and StevenDufresne committed Nov 14, 2024
1 parent 9e91dce commit de01b7a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

<section>
<p><?php printf(
/* Translators: forums URL */
/* Translators: forums welcome page URL */
__( 'Our community-based support forums are a great place to learn, share, and help each other. <a href="%s">Find out how to get started</a>.', 'wporg-forums' ),
esc_url( site_url( '/welcome/' ) )
esc_url( wporg_support_get_welcome_url() )
) ?></p>
</section>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,19 @@ function wporg_is_single_user_profile( bool $is_single_user_profile ) : bool {
}
add_filter( 'bbp_is_single_user_profile', 'wporg_is_single_user_profile' );

/**
* Get the URL for the forums welcome page.
* Slug is translated, so the URL will be correct for the current locale.
*
* @return string
*/
function wporg_support_get_welcome_url() {
return site_url(
/* Translators: slug for the welcome page, e.g. 'welcome' will produce https://wordpress.org/support/welcome/ */
esc_html__( 'welcome', 'wporg-forums' )
);
}


/** bb Base *******************************************************************/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>' . __( '<a href="https://wordpress.org/support/welcome/">Get started</a>', 'wporg-forums' ) . '</p>
<p>' . sprintf(
/* Translators: forums welcome page URL */
__( '<a href="%s">Get started</a>', 'wporg-forums' ),
esc_url( wporg_support_get_welcome_url() )
) . '</p>
<!-- /wp:paragraph -->
</div>
Expand Down

0 comments on commit de01b7a

Please sign in to comment.