Skip to content

Commit

Permalink
i18n: Remove fallback translations from landing/subscriptions hook (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskmnds authored Jan 9, 2025
1 parent 82a7a71 commit d3e9668
Showing 1 changed file with 14 additions and 34 deletions.
48 changes: 14 additions & 34 deletions client/landing/subscriptions/hooks/use-subheader-text.tsx
Original file line number Diff line number Diff line change
@@ -1,47 +1,27 @@
import { SubscriptionManager } from '@automattic/data-stores';
import { useLocale } from '@automattic/i18n-utils';
import { useI18n } from '@wordpress/react-i18n';
import { useTranslate } from 'i18n-calypso';
import { useMemo } from 'react';

const useSubheaderText = () => {
const emailAddress = SubscriptionManager.useSubscriberEmailAddress();
const translate = useTranslate();
const locale = useLocale();
const { hasTranslation } = useI18n();

return useMemo( () => {
if ( emailAddress ) {
return locale.startsWith( 'en' ) ||
hasTranslation(
'Manage WordPress.com sites and newsletters you’ve subscribed to with {{span}}%(emailAddress)s{{/span}}.'
)
? translate(
'Manage WordPress.com sites and newsletters you’ve subscribed to with {{span}}%(emailAddress)s{{/span}}.',
{
args: {
emailAddress: emailAddress,
},
components: {
span: <span className="email-address" />,
},
}
)
: translate(
"Manage the WordPress.com newsletter and blogs you've subscribed to with {{span}}%(emailAddress)s{{/span}}.",
{
args: {
emailAddress: emailAddress,
},
components: {
span: <span className="email-address" />,
},
}
);
return translate(
'Manage WordPress.com sites and newsletters you’ve subscribed to with {{span}}%(emailAddress)s{{/span}}.',
{
args: {
emailAddress: emailAddress,
},
components: {
span: <span className="email-address" />,
},
}
);
}
return locale.startsWith( 'en' ) ||
hasTranslation( 'Manage your WordPress.com site and newsletter subscriptions.' )
? translate( 'Manage your WordPress.com site and newsletter subscriptions.' )
: translate( 'Manage your WordPress.com blog and newsletter subscriptions.' );

return translate( 'Manage your WordPress.com site and newsletter subscriptions.' );
}, [ emailAddress, translate ] );
};

Expand Down

0 comments on commit d3e9668

Please sign in to comment.