Skip to content

Commit

Permalink
Jetpack-mu-wpcom plugin banner - update copies (#39725)
Browse files Browse the repository at this point in the history
* update banner copies

* add changelog entry

* update changelog with correct page name

* enable fallback translations

* ensure jetpack-mu-wpcom domain for translation check
  • Loading branch information
Addison-Stavlo authored Oct 10, 2024
1 parent b8db74b commit 0aa3315
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: changed

Updated copies used in the plugins banner for wpcom sites plugin-install.php page.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,34 @@ function wpcom_plugins_show_banner() {

$asset_file = include Jetpack_Mu_Wpcom::BASE_DIR . 'build/wpcom-plugins-banner/wpcom-plugins-banner.asset.php';

/**
* Check to see if a string has been translated. This is for the purposes of changing the banner
* copies below, this function and checks can be removed after new copies are translated.
*
* @param string $string The string to check.
* @return bool True if the string has been translated, false otherwise.
*/
function should_use_new_translation( $string ) { // phpcs:ignore MediaWiki.Usage.NestedFunctions.NestedFunction
if ( function_exists( 'wpcom_launchpad_has_translation' ) ) {
return wpcom_launchpad_has_translation( $string, 'jetpack-mu-wpcom' );
}
// If that function no longer exists in this context, we can assume the new strings have
// been translated by now.
return true;
}

$banner_title = should_use_new_translation( 'Unlock more with premium and free plugins' ) ?
esc_html__( 'Unlock more with premium and free plugins', 'jetpack-mu-wpcom' ) :
esc_html__( "Flex your site's features with plugins", 'jetpack-mu-wpcom' );

$banner_description = should_use_new_translation( "Discover a curated selection of free and premium plugins designed to enhance your site's functionality and features." ) ?
esc_html__( "Discover a curated selection of free and premium plugins designed to enhance your site's functionality and features.", 'jetpack-mu-wpcom' ) :
esc_html__( "Access a variety of free and paid plugins that can enhance your site's functionality and features.", 'jetpack-mu-wpcom' );

$banner_cta = should_use_new_translation( 'Explore marketplace plugins' ) ?
esc_html__( 'Explore marketplace plugins', 'jetpack-mu-wpcom' ) :
esc_html__( 'Explore plugins', 'jetpack-mu-wpcom' );

wp_enqueue_script(
'wpcom-plugins-banner',
plugins_url( 'build/wpcom-plugins-banner/wpcom-plugins-banner.js', Jetpack_Mu_Wpcom::BASE_FILE ),
Expand All @@ -39,10 +67,10 @@ function wpcom_plugins_show_banner() {
'wpcomPluginsBanner',
array(
'logo' => esc_url( $wpcom_logo ),
'title' => esc_html__( "Flex your site's features with plugins", 'jetpack-mu-wpcom' ),
'description' => esc_html__( "Access a variety of free and paid plugins that can enhance your site's functionality and features.", 'jetpack-mu-wpcom' ),
'title' => $banner_title,
'description' => $banner_description,
'actionUrl' => esc_url( "https://wordpress.com/plugins/$site_slug?ref=woa-plugin-banner" ),
'actionText' => esc_html__( 'Explore plugins', 'jetpack-mu-wpcom' ),
'actionText' => $banner_cta,
'bannerBackground' => esc_url( $background_image ),
)
);
Expand Down

0 comments on commit 0aa3315

Please sign in to comment.