Skip to content

Commit

Permalink
Stats: Update translations that include the product name (#99485)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
a8ck3n authored Feb 11, 2025
1 parent 6e9d249 commit ce95449
Show file tree
Hide file tree
Showing 20 changed files with 109 additions and 39 deletions.
3 changes: 3 additions & 0 deletions client/my-sites/stats/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions client/my-sites/stats/pages/insights/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -61,12 +61,12 @@ function StatsInsights() {
/* eslint-disable wpcalypso/jsx-classname-namespace */
return (
<Main fullWidthLayout>
<DocumentHead title={ translate( 'Jetpack Stats' ) } />
<DocumentHead title={ STATS_PRODUCT_NAME } />
<PageViewTracker path="/stats/insights/:site" title="Stats > Insights" />
<div className="stats">
<NavigationHeader
className="stats__section-header modernized-header"
title={ translate( 'Jetpack Stats' ) }
title={ STATS_PRODUCT_NAME }
subtitle={ translate( "View your site's performance and learn from trends." ) }
screenReader={ navItems.insights?.label }
navigationItems={ [] }
Expand Down
5 changes: 3 additions & 2 deletions client/my-sites/stats/pages/purchase/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import JetpackColophon from 'calypso/components/jetpack-colophon';
import Main from 'calypso/components/main';
import NavigationHeader from 'calypso/components/navigation-header';
import { recordTracksEvent } from 'calypso/lib/analytics/tracks';
import { STATS_PRODUCT_NAME } from 'calypso/my-sites/stats/constants';
import { useSelector } from 'calypso/state';
import { getProductBySlug } from 'calypso/state/products-list/selectors';
import getIsSiteWPCOM from 'calypso/state/selectors/is-site-wpcom';
Expand Down Expand Up @@ -157,7 +158,7 @@ const StatsPurchasePage = ( {

return (
<Main fullWidthLayout>
<DocumentHead title={ translate( 'Jetpack Stats' ) } />
<DocumentHead title={ STATS_PRODUCT_NAME } />
{ ! isLoading && (
<PageViewTracker
path="/stats/purchase/:site"
Expand All @@ -178,7 +179,7 @@ const StatsPurchasePage = ( {
<>
<NavigationHeader
className="stats__section-header modernized-header"
title={ translate( 'Jetpack Stats' ) }
title={ STATS_PRODUCT_NAME }
subtitle={ translate(
"Gain insights into the activity and behavior of your site's visitors. {{learnMoreLink}}Learn more{{/learnMoreLink}}",
{
Expand Down
5 changes: 3 additions & 2 deletions client/my-sites/stats/pages/realtime/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,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_PRODUCT_NAME } from 'calypso/my-sites/stats/constants';
import StatsModuleTopPosts from 'calypso/my-sites/stats/features/modules/stats-top-posts';
import { getSelectedSiteId, getSelectedSiteSlug } from 'calypso/state/ui/selectors';
import AnnualHighlightsSection from '../../sections/annual-highlights-section';
Expand Down Expand Up @@ -44,12 +45,12 @@ function StatsRealtime() {
/* eslint-disable wpcalypso/jsx-classname-namespace */
return (
<Main fullWidthLayout>
<DocumentHead title={ translate( 'Jetpack Stats' ) } />
<DocumentHead title={ STATS_PRODUCT_NAME } />
<PageViewTracker path="/stats/realtime/:site" title="Stats > Realtime" />
<div className="stats">
<NavigationHeader
className="stats__section-header modernized-header"
title={ translate( 'Jetpack Stats' ) }
title={ STATS_PRODUCT_NAME }
subtitle={ translate( "View your site's performance and learn from trends." ) }
screenReader={ navItems.realtime?.label }
navigationItems={ [] }
Expand Down
5 changes: 3 additions & 2 deletions client/my-sites/stats/pages/subscribers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,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_PRODUCT_NAME } from 'calypso/my-sites/stats/constants';
import StatsModuleEmails from 'calypso/my-sites/stats/features/modules/stats-emails';
import statsStrings from 'calypso/my-sites/stats/stats-strings';
import { EmptyListView } from 'calypso/my-sites/subscribers/components/empty-list-view';
Expand Down Expand Up @@ -101,12 +102,12 @@ const StatsSubscribersPage = ( { period }: StatsSubscribersPageProps ) => {

return (
<Main fullWidthLayout>
<DocumentHead title={ translate( 'Jetpack Stats' ) } />
<DocumentHead title={ STATS_PRODUCT_NAME } />
<PageViewTracker path="/stats/subscribers/:site" title="Stats > Subscribers" />
<div className="stats">
<NavigationHeader
className="stats__section-header modernized-header"
title={ translate( 'Jetpack Stats' ) }
title={ STATS_PRODUCT_NAME }
subtitle={ translate( 'Track your subscriber growth and engagement.' ) }
screenReader={ navItems.subscribers?.label }
navigationItems={ [] }
Expand Down
12 changes: 7 additions & 5 deletions client/my-sites/stats/site.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
STATS_FEATURE_DATE_CONTROL_LAST_30_DAYS,
STATS_FEATURE_PAGE_TRAFFIC,
STATS_FEATURE_INTERVAL_DROPDOWN_WEEK,
STATS_PRODUCT_NAME,
} from 'calypso/my-sites/stats/constants';
import { getMomentSiteZone } from 'calypso/my-sites/stats/hooks/use-moment-site-zone';
import {
Expand Down Expand Up @@ -544,7 +545,7 @@ function StatsBody( { siteId, chartTab = 'views', date, context, isInternal, ...
) }
<NavigationHeader
className="stats__section-header modernized-header"
title={ translate( 'Jetpack Stats' ) }
title={ STATS_PRODUCT_NAME }
subtitle={ translate(
"Gain insights into the activity and behavior of your site's visitors. {{learnMoreLink}}Learn more{{/learnMoreLink}}",
{
Expand Down Expand Up @@ -798,11 +799,12 @@ const EnableStatsModule = ( props ) => {
line={
<p>
{ 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 } }
) }
</p>
}
action={ translate( 'Enable Jetpack Stats' ) }
action={ translate( 'Enable %(product)s', { args: { product: STATS_PRODUCT_NAME } } ) }
actionCallback={ enableStatsModule }
/>
);
Expand Down Expand Up @@ -867,7 +869,7 @@ const StatsSite = ( props ) => {
); // Track the last viewed tab.

return (
<Main fullWidthLayout ariaLabel={ translate( 'Jetpack Stats' ) }>
<Main fullWidthLayout ariaLabel={ STATS_PRODUCT_NAME }>
{ config.isEnabled( 'stats/paid-wpcom-v2' ) && ! isOdysseyStats && (
<QuerySiteFeatures siteIds={ [ siteId ] } />
) }
Expand All @@ -880,7 +882,7 @@ const StatsSite = ( props ) => {
) }
{ /* Odyssey: if Stats module is not enabled, the page will not be rendered. */ }
{ ! isOdysseyStats && isJetpack && <QueryJetpackModules siteId={ siteId } /> }
<DocumentHead title={ translate( 'Jetpack Stats' ) } />
<DocumentHead title={ STATS_PRODUCT_NAME } />
<PageViewTracker
path={ `/stats/${ period }/:site` }
title={ `Stats > ${ titlecase( period ) }` }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
};

Expand Down
3 changes: 2 additions & 1 deletion client/my-sites/stats/stats-email-detail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -216,7 +217,7 @@ class StatsEmailDetail extends Component {
isRequesting={ isRequestingStats }
/>

<DocumentHead title={ translate( 'Jetpack Stats' ) } />
<DocumentHead title={ STATS_PRODUCT_NAME } />

<PageViewTracker
path="/stats/email/:statType/:site/:period/:email_id"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { localizeUrl } from '@automattic/i18n-utils';
import { Icon, external } from '@wordpress/icons';
import { useTranslate } from 'i18n-calypso';
import { useEffect } from 'react';
import { STATS_PRODUCT_NAME } from 'calypso/my-sites/stats/constants';
import usePlanUsageQuery from 'calypso/my-sites/stats/hooks/use-plan-usage-query';
import { useSelector } from 'calypso/state';
import getIsSiteWPCOM from 'calypso/state/selectors/is-site-wpcom';
Expand Down Expand Up @@ -93,23 +94,26 @@ const CommercialSiteUpgradeNotice = ( {
);
} else if ( ! paywallUpgradeDeadlineDate ) {
bannerBody = translate(
'{{p}}To ensure uninterrupted access to core Stats features, please upgrade to a Jetpack Stats Commercial license using the button below. {{/p}}{{p}}{{jetpackStatsProductLink}}Upgrade my Stats{{/jetpackStatsProductLink}} {{commercialUpgradeLink}}{{commercialUpgradeLinkText}}Learn more{{/commercialUpgradeLinkText}}{{externalIcon /}}{{/commercialUpgradeLink}}{{/p}}',
'{{p}}To ensure uninterrupted access to core Stats features, please upgrade to a %(product)s Commercial license using the button below. {{/p}}{{p}}{{jetpackStatsProductLink}}Upgrade my Stats{{/jetpackStatsProductLink}} {{commercialUpgradeLink}}{{commercialUpgradeLinkText}}Learn more{{/commercialUpgradeLinkText}}{{externalIcon /}}{{/commercialUpgradeLink}}{{/p}}',
{
args: { product: STATS_PRODUCT_NAME },
components: sharedTranslationComponents,
}
);
} else {
bannerBody = translate(
'{{p}}To ensure uninterrupted access to core Stats features, please upgrade to a Jetpack Stats Commercial license using the button below by {{b}}%(date)s{{/b}}. {{/p}}{{p}}{{jetpackStatsProductLink}}Upgrade my Stats{{/jetpackStatsProductLink}}{{commercialUpgradeLink}}{{commercialUpgradeLinkText}}Learn more{{/commercialUpgradeLinkText}}{{externalIcon /}}{{/commercialUpgradeLink}}{{/p}}',
'{{p}}To ensure uninterrupted access to core Stats features, please upgrade to a %(product)s Commercial license using the button below by {{b}}%(date)s{{/b}}. {{/p}}{{p}}{{jetpackStatsProductLink}}Upgrade my Stats{{/jetpackStatsProductLink}}{{commercialUpgradeLink}}{{commercialUpgradeLinkText}}Learn more{{/commercialUpgradeLinkText}}{{externalIcon /}}{{/commercialUpgradeLink}}{{/p}}',
{
args: { date: paywallUpgradeDeadlineDate },
args: { date: paywallUpgradeDeadlineDate, product: STATS_PRODUCT_NAME },
components: sharedTranslationComponents,
}
);
}

const bannerTitle = showPaywallNotice
? translate( 'You need to upgrade to a commercial license to continue using Jetpack Stats' )
? ( translate( 'You need to upgrade to a commercial license to continue using %(product)s', {
args: { product: STATS_PRODUCT_NAME },
} ) as string )
: translate( 'Upgrade to Stats Commercial' );

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Icon, external } from '@wordpress/icons';
import { useTranslate } from 'i18n-calypso';
import { useEffect, useState } from 'react';
import { useDispatch } from 'react-redux';
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 getIsSiteWPCOM from 'calypso/state/selectors/is-site-wpcom';
Expand Down Expand Up @@ -103,9 +104,15 @@ const DoYouLoveJetpackStatsNotice = ( {
}

const noPurchaseTitle = isWPCOMPaidStatsFlow
? translate( 'Grow faster with Jetpack Stats' )
: translate( 'Do you love Jetpack Stats?' );
const freeTitle = translate( 'Want to get the most out of Jetpack Stats?' );
? ( translate( 'Grow faster with %(product)s', {
args: { product: STATS_PRODUCT_NAME },
} ) as string )
: ( translate( 'Do you love %(product)s?', {
args: { product: STATS_PRODUCT_NAME },
} ) as string );
const freeTitle = translate( 'Want to get the most out of %(product)s?', {
args: { product: STATS_PRODUCT_NAME },
} ) as string;

const learnMoreLink = isWPCOMSite
? 'https://wordpress.com/support/stats/#purchase-the-stats-add-on'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import page from '@automattic/calypso-router';
import NoticeBanner from '@automattic/components/src/notice-banner';
import { useTranslate } from 'i18n-calypso';
import { useEffect, useState } from 'react';
import { STATS_PRODUCT_NAME } from 'calypso/my-sites/stats/constants';
import { removeStatsPurchaseSuccessParamFromCurrentUrl } from './lib/remove-stats-purchase-success-param';
import { StatsNoticeProps } from './types';

Expand Down Expand Up @@ -60,7 +61,11 @@ const FreePlanPurchaseSuccessJetpackStatsNotice = ( {
>
<NoticeBanner
level="success"
title={ translate( 'Thank you for using Jetpack Stats!' ) }
title={
translate( 'Thank you for using %(product)s!', {
args: { product: STATS_PRODUCT_NAME },
} ) as string
}
onClose={ dismissNotice }
>
{ translate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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: (
<a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import NoticeBanner from '@automattic/components/src/notice-banner';
import { useTranslate } from 'i18n-calypso';
import { useEffect, useState } from 'react';
import { STATS_PRODUCT_NAME } from 'calypso/my-sites/stats/constants';
import { removeStatsPurchaseSuccessParamFromCurrentUrl } from './lib/remove-stats-purchase-success-param';
import { PaidPlanPurchaseSuccessJetpackStatsNoticeProps } from './types';

Expand Down Expand Up @@ -37,7 +38,11 @@ const PaidPlanPurchaseSuccessJetpackStatsNotice = ( {
>
<NoticeBanner
level="success"
title={ translate( 'Thank you for supporting Jetpack Stats!' ) }
title={
translate( 'Thank you for supporting %(product)s!', {
args: { product: STATS_PRODUCT_NAME },
} ) as string
}
onClose={ dismissNotice }
>
{ isCommercial
Expand Down
6 changes: 4 additions & 2 deletions client/my-sites/stats/stats-page-loader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -39,11 +40,12 @@ const EnableStatsModuleNotice = ( { siteId, path }: { siteId: number; path: stri
line={
<p>
{ 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 } }
) }
</p>
}
action={ translate( 'Enable Jetpack Stats' ) }
action={ translate( 'Enable %(product)s', { args: { product: STATS_PRODUCT_NAME } } ) }
actionCallback={ () => enableJetpackStatsModule( siteId, path ) }
/>
);
Expand Down
19 changes: 16 additions & 3 deletions client/my-sites/stats/stats-purchase/stats-purchase-notice.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -43,7 +44,11 @@ const StatsCommercialOwned = ( { siteSlug } ) => {

return (
<>
<h1>{ translate( 'You already have a commercial license for Jetpack Stats.' ) }</h1>
<h1>
{ translate( 'You already have a commercial license for %(product)s.', {
args: { product: STATS_PRODUCT_NAME },
} ) }
</h1>
<p>
{ translate(
'You already have a license for this product and it has been successfully activated. You currently have access to:'
Expand Down Expand Up @@ -72,7 +77,11 @@ const StatsPWYWOwnedNotice = ( { siteId, siteSlug } ) => {

return (
<StatsSingleItemPagePurchaseFrame>
<h1>{ translate( 'You already have a license for Jetpack Stats.' ) }</h1>
<h1>
{ translate( 'You already have a license for %(product)s.', {
args: { product: STATS_PRODUCT_NAME },
} ) }
</h1>
<p>
{ translate(
'You already have a license for this product and it has been successfully activated. You currently have access to:'
Expand Down Expand Up @@ -109,7 +118,11 @@ const StatsFreeOwnedNotice = ( { siteId, siteSlug } ) => {

return (
<StatsSingleItemPagePurchaseFrame>
<h1>{ translate( 'You already have a free license for Jetpack Stats.' ) }</h1>
<h1>
{ translate( 'You already have a free license for %(product)s.', {
args: { product: STATS_PRODUCT_NAME },
} ) }
</h1>
<p>
{ translate(
'You already have a license for this product and it has been successfully activated. You currently have access to:'
Expand Down
Loading

0 comments on commit ce95449

Please sign in to comment.