Skip to content

Commit

Permalink
Add fallback for un-translated Plan copy changes (#62402)
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiucelfilip authored and Rolilink committed Mar 31, 2022
1 parent 50f440b commit da7d2a3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
6 changes: 4 additions & 2 deletions client/my-sites/plans-comparison/plans-comparison-action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '@automattic/calypso-products';
import { Button } from '@automattic/components';
import classNames from 'classnames';
import { useTranslate } from 'i18n-calypso';
import i18n, { useTranslate } from 'i18n-calypso';
import { useCallback } from 'react';
import type { WPComPlan } from '@automattic/calypso-products';
import type { TranslateResult } from 'i18n-calypso';
Expand All @@ -35,7 +35,9 @@ function getButtonText( props: Partial< Props >, translate: TranslateFunc ): Tra
const planSlug = plan?.getStoreSlug();

if ( planSlug === PLAN_WPCOM_PRO ) {
return translate( 'Start with Pro' );
return 'en' === i18n.getLocaleSlug() || i18n.hasTranslation( 'Start with Pro' )
? translate( 'Start with Pro' )
: translate( 'Try Pro risk-free' );
} else if ( planSlug === PLAN_FREE || planSlug === PLAN_WPCOM_FLEXIBLE ) {
return translate( 'Start with Free' );
}
Expand Down
15 changes: 10 additions & 5 deletions client/signup/steps/plans/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getUrlParts } from '@automattic/calypso-url';
import { Button } from '@automattic/components';
import { isDesktop, subscribeIsDesktop } from '@automattic/viewport';
import classNames from 'classnames';
import { localize } from 'i18n-calypso';
import i18n, { localize } from 'i18n-calypso';
import PropTypes from 'prop-types';
import { parse as parseQs } from 'qs';
import { Component } from 'react';
Expand Down Expand Up @@ -275,10 +275,12 @@ export class PlansStep extends Component {
}

getHeaderText() {
const { headerText, translate, eligibleForProPlan } = this.props;
const { headerText, translate, eligibleForProPlan, locale } = this.props;

if ( eligibleForProPlan ) {
return translate( 'Choose your hosting plan' );
return 'en' === locale || i18n.hasTranslation( 'Choose your hosting plan' )
? translate( 'Choose your hosting plan' )
: translate( 'Choose the plan that’s right for you' );
}

if ( this.state.isDesktop ) {
Expand All @@ -289,10 +291,13 @@ export class PlansStep extends Component {
}

getSubHeaderText() {
const { hideFreePlan, subHeaderText, translate, eligibleForProPlan } = this.props;
const { hideFreePlan, subHeaderText, translate, eligibleForProPlan, locale } = this.props;

if ( eligibleForProPlan ) {
return translate( 'The WordPress Pro plan comes with a 14-day money back guarantee' );
return 'en' === locale ||
i18n.hasTranslation( 'he WordPress Pro plan comes with a 14-day money back guarantee' )
? translate( 'The WordPress Pro plan comes with a 14-day money back guarantee' )
: translate( 'The WordPress Pro plan comes with a 14-day full money back guarantee' );
}

if ( ! hideFreePlan ) {
Expand Down

0 comments on commit da7d2a3

Please sign in to comment.