From ce954497c725e8af9f5e93dff7a437e35f5a8e47 Mon Sep 17 00:00:00 2001 From: Kevin L <40267301+a8ck3n@users.noreply.github.com> Date: Tue, 11 Feb 2025 15:09:45 +0800 Subject: [PATCH] Stats: Update translations that include the product name (#99485) * Introduce const for product name * Update usage across dashboard pages * Update top-level usage * Two more translated product names * Update usage in permissions notice * Update usage in upgrade notices * Update DoYouLove notice * Update usage in Enable Stats prompt * Update usage in single purchase flow * Update usage in Upsell modal * Update usage in upsell copy * Update usage in notices * Update usage in purchase flows * Fix import error --- client/my-sites/stats/constants.ts | 3 +++ .../my-sites/stats/pages/insights/index.jsx | 6 +++--- .../my-sites/stats/pages/purchase/index.tsx | 5 +++-- .../my-sites/stats/pages/realtime/index.jsx | 5 +++-- .../stats/pages/subscribers/index.tsx | 5 +++-- client/my-sites/stats/site.jsx | 12 +++++++----- .../stats-card-upsell/stats-upsell-copy.tsx | 5 ++++- .../stats/stats-email-detail/index.jsx | 3 ++- .../commercial-site-upgrade-notice.tsx | 12 ++++++++---- .../do-you-love-jetpack-stats-notice.tsx | 13 ++++++++++--- .../free-plan-purchase-success-notice.tsx | 7 ++++++- .../gdpr-cookie-consent-notice.tsx | 4 +++- .../paid-plan-purchase-success-notice.tsx | 7 ++++++- .../stats/stats-page-loader/index.tsx | 6 ++++-- .../stats-purchase/stats-purchase-notice.jsx | 19 ++++++++++++++++--- .../stats-purchase-personal.tsx | 5 ++++- .../stats-purchase-preview-image.tsx | 5 ++++- .../stats-purchase-single-item.tsx | 18 ++++++++++++++---- .../stats/stats-upsell-modal/index.tsx | 5 ++++- client/my-sites/stats/wordads/index.jsx | 3 ++- 20 files changed, 109 insertions(+), 39 deletions(-) diff --git a/client/my-sites/stats/constants.ts b/client/my-sites/stats/constants.ts index 29fc9f529e633..07c1a73fc3380 100644 --- a/client/my-sites/stats/constants.ts +++ b/client/my-sites/stats/constants.ts @@ -6,6 +6,9 @@ export const STATS_PERIOD = { YEAR: 'year', }; +// The product title. Do not translate. +export const STATS_PRODUCT_NAME = 'Jetpack Stats'; + // statTypes referred from // https://github.com/Automattic/wp-calypso/blob/trunk/packages/wpcom.js/src/lib/runtime/site.get.js // stat features are newly defined in this file diff --git a/client/my-sites/stats/pages/insights/index.jsx b/client/my-sites/stats/pages/insights/index.jsx index ac6f822428b52..95a81f14a85cf 100644 --- a/client/my-sites/stats/pages/insights/index.jsx +++ b/client/my-sites/stats/pages/insights/index.jsx @@ -9,7 +9,7 @@ import DocumentHead from 'calypso/components/data/document-head'; import JetpackColophon from 'calypso/components/jetpack-colophon'; import Main from 'calypso/components/main'; import NavigationHeader from 'calypso/components/navigation-header'; -import { STATS_FEATURE_PAGE_INSIGHTS } from 'calypso/my-sites/stats/constants'; +import { STATS_FEATURE_PAGE_INSIGHTS, STATS_PRODUCT_NAME } from 'calypso/my-sites/stats/constants'; import StatsModuleComments from 'calypso/my-sites/stats/features/modules/stats-comments'; import StatShares from 'calypso/my-sites/stats/features/modules/stats-shares'; import StatsModuleTags from 'calypso/my-sites/stats/features/modules/stats-tags'; @@ -61,12 +61,12 @@ function StatsInsights() { /* eslint-disable wpcalypso/jsx-classname-namespace */ return (
- +
- + { ! isLoading && ( - +
{ return (
- +
{ line={

{ translate( - 'Enable Jetpack Stats to see detailed information about your traffic, likes, comments, and subscribers.' + 'Enable %(product)s to see detailed information about your traffic, likes, comments, and subscribers.', + { args: { product: STATS_PRODUCT_NAME } } ) }

} - action={ translate( 'Enable Jetpack Stats' ) } + action={ translate( 'Enable %(product)s', { args: { product: STATS_PRODUCT_NAME } } ) } actionCallback={ enableStatsModule } /> ); @@ -867,7 +869,7 @@ const StatsSite = ( props ) => { ); // Track the last viewed tab. return ( -
+
{ config.isEnabled( 'stats/paid-wpcom-v2' ) && ! isOdysseyStats && ( ) } @@ -880,7 +882,7 @@ const StatsSite = ( props ) => { ) } { /* Odyssey: if Stats module is not enabled, the page will not be rendered. */ } { ! isOdysseyStats && isJetpack && } - + ${ titlecase( period ) }` } diff --git a/client/my-sites/stats/stats-card-upsell/stats-upsell-copy.tsx b/client/my-sites/stats/stats-card-upsell/stats-upsell-copy.tsx index b08c552994d1c..c140e0e822a24 100644 --- a/client/my-sites/stats/stats-card-upsell/stats-upsell-copy.tsx +++ b/client/my-sites/stats/stats-card-upsell/stats-upsell-copy.tsx @@ -7,6 +7,7 @@ import { JETPACK_SUPPORT_VIDEOPRESS_URL_STATS, } from 'calypso/my-sites/stats/const'; import { + STATS_PRODUCT_NAME, STATS_FEATURE_DATE_CONTROL, STATS_FEATURE_LOCATION_REGION_VIEWS, STATS_FEATURE_LOCATION_CITY_VIEWS, @@ -203,7 +204,9 @@ const getUpsellCopy = ( statType: string ) => { case STAT_TYPE_COMMENTS: return translate( 'Top comments overview.' ); default: - return translate( 'Upgrade your plan to unlock Jetpack Stats.' ); + return translate( 'Upgrade your plan to unlock %(product)s.', { + args: { product: STATS_PRODUCT_NAME }, + } ) as string; } }; diff --git a/client/my-sites/stats/stats-email-detail/index.jsx b/client/my-sites/stats/stats-email-detail/index.jsx index 35e7af7b1b1f3..8ee9912593b30 100644 --- a/client/my-sites/stats/stats-email-detail/index.jsx +++ b/client/my-sites/stats/stats-email-detail/index.jsx @@ -20,6 +20,7 @@ import Main from 'calypso/components/main'; import NavigationHeader from 'calypso/components/navigation-header'; import { decodeEntities, stripHTML } from 'calypso/lib/formatting'; import memoizeLast from 'calypso/lib/memoize-last'; +import { STATS_PRODUCT_NAME } from 'calypso/my-sites/stats/constants'; import StatsEmailModule from 'calypso/my-sites/stats/stats-email-module'; import { recordGoogleEvent } from 'calypso/state/analytics/actions'; import { getSitePost } from 'calypso/state/posts/selectors'; @@ -216,7 +217,7 @@ class StatsEmailDetail extends Component { isRequesting={ isRequestingStats } /> - + { translate( diff --git a/client/my-sites/stats/stats-notices/gdpr-cookie-consent-notice.tsx b/client/my-sites/stats/stats-notices/gdpr-cookie-consent-notice.tsx index c50da047fa301..4c48dce8a16fd 100644 --- a/client/my-sites/stats/stats-notices/gdpr-cookie-consent-notice.tsx +++ b/client/my-sites/stats/stats-notices/gdpr-cookie-consent-notice.tsx @@ -3,6 +3,7 @@ import NoticeBanner from '@automattic/components/src/notice-banner'; import clsx from 'clsx'; import { useTranslate } from 'i18n-calypso'; import { useState } from 'react'; +import { STATS_PRODUCT_NAME } from 'calypso/my-sites/stats/constants'; import useNoticeVisibilityMutation from 'calypso/my-sites/stats/hooks/use-notice-visibility-mutation'; import { useSelector } from 'calypso/state'; import getSiteAdminUrl from 'calypso/state/sites/selectors/get-site-admin-url'; @@ -41,8 +42,9 @@ const GDPRCookieConsentNotice = ( { siteId, isOdysseyStats }: StatsNoticeProps ) const bannerBody = isOdysseyStats ? translate( - 'Your site visitors must now consent to be tracked in Jetpack Stats, which might result in a decrease in reported statistics as some visitors may not give consent. To adjust this, go to {{link}}Complianz settings{{/link}} to manage the Jetpack integration.', + 'Your site visitors must now consent to be tracked in %(product)s, which might result in a decrease in reported statistics as some visitors may not give consent. To adjust this, go to {{link}}Complianz settings{{/link}} to manage the Jetpack integration.', { + args: { product: STATS_PRODUCT_NAME }, components: { link: ( { isCommercial diff --git a/client/my-sites/stats/stats-page-loader/index.tsx b/client/my-sites/stats/stats-page-loader/index.tsx index 04bdc95554d36..16cc8ffd40d40 100644 --- a/client/my-sites/stats/stats-page-loader/index.tsx +++ b/client/my-sites/stats/stats-page-loader/index.tsx @@ -5,6 +5,7 @@ import { useSelector, useDispatch } from 'react-redux'; import illustration404 from 'calypso/assets/images/illustrations/illustration-404.svg'; import QuerySitePurchases from 'calypso/components/data/query-site-purchases'; import EmptyContent from 'calypso/components/empty-content'; +import { STATS_PRODUCT_NAME } from 'calypso/my-sites/stats/constants'; import usePlanUsageQuery from 'calypso/my-sites/stats/hooks/use-plan-usage-query'; import { STATS_PLAN_USAGE_RECEIVE } from 'calypso/state/action-types'; import { recordTracksEvent, withAnalytics } from 'calypso/state/analytics/actions'; @@ -39,11 +40,12 @@ const EnableStatsModuleNotice = ( { siteId, path }: { siteId: number; path: stri line={

{ translate( - 'Enable Jetpack Stats to see detailed information about your traffic, likes, comments, and subscribers.' + 'Enable %(product)s to see detailed information about your traffic, likes, comments, and subscribers.', + { args: { product: STATS_PRODUCT_NAME } } ) }

} - action={ translate( 'Enable Jetpack Stats' ) } + action={ translate( 'Enable %(product)s', { args: { product: STATS_PRODUCT_NAME } } ) } actionCallback={ () => enableJetpackStatsModule( siteId, path ) } /> ); diff --git a/client/my-sites/stats/stats-purchase/stats-purchase-notice.jsx b/client/my-sites/stats/stats-purchase/stats-purchase-notice.jsx index c24a97538c8d9..db07f2c55331d 100644 --- a/client/my-sites/stats/stats-purchase/stats-purchase-notice.jsx +++ b/client/my-sites/stats/stats-purchase/stats-purchase-notice.jsx @@ -3,6 +3,7 @@ import config from '@automattic/calypso-config'; import page from '@automattic/calypso-router'; import { Button } from '@wordpress/components'; import { useTranslate } from 'i18n-calypso'; +import { STATS_PRODUCT_NAME } from 'calypso/my-sites/stats/constants'; import { trackStatsAnalyticsEvent } from '../utils'; import { StatsBenefitsCommercial, @@ -43,7 +44,11 @@ const StatsCommercialOwned = ( { siteSlug } ) => { return ( <> -

{ translate( 'You already have a commercial license for Jetpack Stats.' ) }

+

+ { translate( 'You already have a commercial license for %(product)s.', { + args: { product: STATS_PRODUCT_NAME }, + } ) } +

{ translate( 'You already have a license for this product and it has been successfully activated. You currently have access to:' @@ -72,7 +77,11 @@ const StatsPWYWOwnedNotice = ( { siteId, siteSlug } ) => { return ( -

{ translate( 'You already have a license for Jetpack Stats.' ) }

+

+ { translate( 'You already have a license for %(product)s.', { + args: { product: STATS_PRODUCT_NAME }, + } ) } +

{ translate( 'You already have a license for this product and it has been successfully activated. You currently have access to:' @@ -109,7 +118,11 @@ const StatsFreeOwnedNotice = ( { siteId, siteSlug } ) => { return ( -

{ translate( 'You already have a free license for Jetpack Stats.' ) }

+

+ { translate( 'You already have a free license for %(product)s.', { + args: { product: STATS_PRODUCT_NAME }, + } ) } +

{ translate( 'You already have a license for this product and it has been successfully activated. You currently have access to:' diff --git a/client/my-sites/stats/stats-purchase/stats-purchase-personal.tsx b/client/my-sites/stats/stats-purchase/stats-purchase-personal.tsx index 3030511333ee9..5d23bf63d028e 100644 --- a/client/my-sites/stats/stats-purchase/stats-purchase-personal.tsx +++ b/client/my-sites/stats/stats-purchase/stats-purchase-personal.tsx @@ -5,6 +5,7 @@ import { Button, CheckboxControl } from '@wordpress/components'; import { useTranslate } from 'i18n-calypso'; import React, { useState } from 'react'; import { recordTracksEvent } from 'calypso/lib/analytics/tracks'; +import { STATS_PRODUCT_NAME } from 'calypso/my-sites/stats/constants'; import { useJetpackConnectionStatus } from 'calypso/my-sites/stats/hooks/use-jetpack-connection-status'; import useStatsPurchases from 'calypso/my-sites/stats/hooks/use-stats-purchases'; import { useSelector } from 'calypso/state'; @@ -191,7 +192,9 @@ const PersonalPurchase = ( { } ) } > - { translate( 'Continue with Jetpack Stats for free' ) } + { translate( 'Continue with %(product)s for free', { + args: { product: STATS_PRODUCT_NAME }, + } ) }

) : ( diff --git a/client/my-sites/stats/stats-purchase/stats-purchase-preview-image.tsx b/client/my-sites/stats/stats-purchase/stats-purchase-preview-image.tsx index 4f5124d42d3c3..993e449e35bdb 100644 --- a/client/my-sites/stats/stats-purchase/stats-purchase-preview-image.tsx +++ b/client/my-sites/stats/stats-purchase/stats-purchase-preview-image.tsx @@ -1,13 +1,16 @@ import { useTranslate } from 'i18n-calypso'; import statsPurchasePreviewPNG from 'calypso/assets/images/stats/purchase-preview.png'; import statsPurchasePreviewPNG2xRetina from 'calypso/assets/images/stats/purchase-preview@2x.png'; +import { STATS_PRODUCT_NAME } from 'calypso/my-sites/stats/constants'; const StatsPurchasePreviewImage = () => { const translate = useTranslate(); // Determine which image to use based on device pixel ratio. const previewImage = window.devicePixelRatio > 1 ? statsPurchasePreviewPNG2xRetina : statsPurchasePreviewPNG; - const imageAltText = translate( 'Preview of the full Jetpack Stats dashboard' ); + const imageAltText = translate( 'Preview of the full %(product)s dashboard', { + args: { product: STATS_PRODUCT_NAME }, + } ) as string; // See stats-purchase-svg.tsx for Odyssey/DotCom detection logic if needed. return {; diff --git a/client/my-sites/stats/stats-purchase/stats-purchase-single-item.tsx b/client/my-sites/stats/stats-purchase/stats-purchase-single-item.tsx index 88234cc0f4359..406ca4c9b8d1a 100644 --- a/client/my-sites/stats/stats-purchase/stats-purchase-single-item.tsx +++ b/client/my-sites/stats/stats-purchase/stats-purchase-single-item.tsx @@ -5,6 +5,7 @@ import { Button, CheckboxControl } from '@wordpress/components'; import { useTranslate } from 'i18n-calypso'; import React, { useState, useCallback, useMemo, useEffect } from 'react'; import { recordTracksEvent } from 'calypso/lib/analytics/tracks'; +import { STATS_PRODUCT_NAME } from 'calypso/my-sites/stats/constants'; import { useJetpackConnectionStatus } from 'calypso/my-sites/stats/hooks/use-jetpack-connection-status'; import { useSelector } from 'calypso/state'; import getIsSiteWPCOM from 'calypso/state/selectors/is-site-wpcom'; @@ -115,7 +116,9 @@ const useLocalizedStrings = ( isCommercial: boolean ) => { // Page title, info text, and button text depend on isCommercial status of site. if ( isCommercial ) { return { - pageTitle: translate( 'Upgrade and continue using Jetpack Stats' ), + pageTitle: translate( 'Upgrade and continue using %(product)s', { + args: { product: STATS_PRODUCT_NAME }, + } ), infoText: translate( 'To continue using Stats and access its newest premium features you need to get a commercial license. {{link}}Learn more about this update{{/link}}.', { @@ -133,7 +136,8 @@ const useLocalizedStrings = ( isCommercial: boolean ) => { return { pageTitle: translate( 'Simple, yet powerful stats to grow your site' ), infoText: translate( - 'Jetpack Stats makes it easy to see how your site is doing. No data science skills needed. Start with a commercial license and get premium access to:' + '%(product)s makes it easy to see how your site is doing. No data science skills needed. Start with a commercial license and get premium access to:', + { args: { product: STATS_PRODUCT_NAME } } ), continueButtonText: translate( 'Get Stats to grow my site' ), }; @@ -278,9 +282,15 @@ const StatsPersonalPurchase = ( { return ( <> -

{ translate( 'Support Jetpack Stats and set your price' ) }

+

+ { translate( 'Support %(product)s and set your price', { + args: { product: STATS_PRODUCT_NAME }, + } ) } +

- { translate( 'Help Jetpack Stats with a non-commercial license and get these perks:' ) } + { translate( 'Help %(product)s with a non-commercial license and get these perks:', { + args: { product: STATS_PRODUCT_NAME }, + } ) }

- { translate( 'Grow faster with Jetpack Stats' ) } + { translate( 'Grow faster with %(product)s', { + args: { product: STATS_PRODUCT_NAME }, + } ) }

{ translate( 'Finesse your scaling-up strategy with detailed insights and data.' ) } diff --git a/client/my-sites/stats/wordads/index.jsx b/client/my-sites/stats/wordads/index.jsx index 8bd3d97be3fd6..6e31919bfbfea 100644 --- a/client/my-sites/stats/wordads/index.jsx +++ b/client/my-sites/stats/wordads/index.jsx @@ -19,6 +19,7 @@ import EmptyContent from 'calypso/components/empty-content'; import JetpackColophon from 'calypso/components/jetpack-colophon'; import Main from 'calypso/components/main'; import NavigationHeader from 'calypso/components/navigation-header'; +import { STATS_PRODUCT_NAME } from 'calypso/my-sites/stats/constants'; import { recordGoogleEvent } from 'calypso/state/analytics/actions'; import { canCurrentUser } from 'calypso/state/selectors/can-current-user'; import { canAccessWordAds } from 'calypso/state/sites/selectors'; @@ -174,7 +175,7 @@ class WordAds extends Component {