Skip to content

Commit

Permalink
add translations for advanced tools
Browse files Browse the repository at this point in the history
  • Loading branch information
madhusudhand committed Nov 21, 2024
1 parent 2e41f39 commit 4ae4e46
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 13 deletions.
2 changes: 1 addition & 1 deletion client/sites/tools/controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function ToolsSidebar() {
}

export function advancedTools( context: PageJSContext, next: () => void ) {
context.primary = <HostingFeatures />;
context.primary = <HostingFeatures showAsTools />;
next();
}

Expand Down
56 changes: 44 additions & 12 deletions client/sites/tools/hosting-features/components/hosting-features.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ const PromoCard = ( { title, text, supportContext }: PromoCardProps ) => (
</HostingCard>
);

const HostingFeatures = () => {
type HostingFeaturesProps = {
showAsTools?: boolean;
};

const HostingFeatures = ( { showAsTools }: HostingFeaturesProps ) => {
const dispatch = useDispatch();
const { searchParams } = new URL( document.location.toString() );
const showActivationModal = searchParams.get( 'activate' ) !== null;
Expand Down Expand Up @@ -133,10 +137,30 @@ const HostingFeatures = () => {
? translate( 'Activate all hosting features' )
: translate( 'Activate all developer tools' );

const activateTitleAsTools = hasEnTranslation( 'Activate all advanced tools' );

const activationStatusTitle = translate( 'Activating hosting features' );
const activationStatusTitleAsTools = translate( 'Activating advanced tools' );

const activationStatusDescription = translate(
"The hosting features will appear here automatically when they're ready!",
{
comment: 'Description of the hosting features page when the features are being activated.',
}
);
const activationStatusDescriptionAsTools = translate(
"The advanced tools will appear here automatically when they're ready!",
{
comment: 'Description of the advanced tools page when the features are being activated.',
}
);

const unlockTitle = hasEnTranslation( 'Unlock all hosting features' )
? translate( 'Unlock all hosting features' )
: translate( 'Unlock all developer tools' );

const unlockTitleAsTools = translate( 'Unlock all advanced tools' );

const activateDescription = hasEnTranslation(
'Your plan includes all the hosting features listed below. Click "Activate now" to begin.'
)
Expand All @@ -147,6 +171,10 @@ const HostingFeatures = () => {
'Your plan includes all the developer tools listed below. Click "Activate now" to begin.'
);

const activateDescriptionAsTools = translate(
'Your plan includes all the advanced tools listed below. Click "Activate now" to begin.'
);

const unlockDescription = hasEnTranslation(
'Upgrade to the %(planName)s plan or higher to get access to all hosting features'
)
Expand All @@ -169,20 +197,24 @@ const HostingFeatures = () => {
}
);

const unlockDescriptionAsTools = translate(
'Upgrade to the %(planName)s plan or higher to get access to all advanced tools',
{
args: {
planName: getPlan( PLAN_BUSINESS )?.getTitle() ?? '',
},
}
);

let title;
let description;
let buttons;
if ( shouldRenderActivatingCopy ) {
title = translate( 'Activating hosting features' );
description = translate(
"The hosting features will appear here automatically when they're ready!",
{
comment: 'Description of the hosting features page when the features are being activated.',
}
);
title = showAsTools ? activationStatusTitleAsTools : activationStatusTitle;
description = showAsTools ? activationStatusDescriptionAsTools : activationStatusDescription;
} else if ( showActivationButton ) {
title = activateTitle;
description = activateDescription;
title = showAsTools ? activateTitleAsTools : activateTitle;
description = showAsTools ? activateDescriptionAsTools : activateDescription;
buttons = (
<>
<HostingHeroButton
Expand Down Expand Up @@ -215,8 +247,8 @@ const HostingFeatures = () => {
</>
);
} else {
title = unlockTitle;
description = unlockDescription;
title = showAsTools ? unlockTitleAsTools : unlockTitle;
description = showAsTools ? unlockDescriptionAsTools : unlockDescription;
buttons = (
<HostingHeroButton
href={ upgradeLink }
Expand Down

0 comments on commit 4ae4e46

Please sign in to comment.