How to use the i18n-calypso.useTranslate function in i18n-calypso

To help you get started, we’ve selected a few i18n-calypso examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Automattic / wp-calypso / client / auth / self-hosted-instructions.jsx View on Github external
export default function SelfHostedInstructions( { onClickClose } ) {
	const translate = useTranslate();

	return (
		<div>
			<button>
				
			</button>

			<h2>{ translate( 'Add self-hosted site' ) }</h2>
			<p>
				{ translate(
					'By default when you sign into the WordPress.com app, you can edit blogs and sites hosted at WordPress.com'
				) }
			</p>
			<p>
				{ translate(
					"If you'd like to edit your self-hosted WordPress blog or site, you can do that by following these instructions:"</p></div>
github Automattic / wp-calypso / client / me / help / gm-closure-notice / index.jsx View on Github external
const GMClosureNotice = ( {
	priorityChatClosesAt,
	priorityChatReopensAt,
	compact,
	basicChatClosesAt,
	basicChatReopensAt,
	displayAt,
	purchases,
} ) => {
	const translate = useTranslate();
	const moment = useLocalizedMoment();

	const hasBusinessOrEcommercePlan = some(
		purchases,
		( { productSlug } ) => isBusinessPlan( productSlug ) || isEcommercePlan( productSlug )
	);
	const hasPersonalOrPremiumPlan = some(
		purchases,
		( { productSlug } ) => isPersonalPlan( productSlug ) || isPremiumPlan( productSlug )
	);
	const hasNoPlan = ! hasBusinessOrEcommercePlan && ! hasPersonalOrPremiumPlan;

	const currentDate = moment();
	const guessedTimezone = moment.tz.guess();

	const [ closesAt, reopensAt ] = [
github Automattic / wp-calypso / client / my-sites / marketing / tools / header.tsx View on Github external
const MarketingToolsHeader: FunctionComponent&lt; Props &gt; = ( { handleButtonClick } ) =&gt; {
	const translate = useTranslate();

	return (
		
			<div>
				<img alt="{" src="/calypso/images/illustrations/illustration-404.svg">
			</div>

			<div>
				<h1>
					{ translate( 'Drive more traffic to your site with better SEO' ) }
				</h1>
</div>
github Automattic / wp-calypso / client / jetpack-connect / help-button.jsx View on Github external
export default function JetpackConnectHelpButton( { label } ) {
	const dispatch = useDispatch();
	const translate = useTranslate();

	const recordClick = React.useCallback( () =&gt; {
		dispatch( recordTracksEvent( 'calypso_jpc_help_link_click' ) );
	}, [ dispatch ] );

	return (
		
			{ ' ' }
			{ label || translate( 'Get help setting up Jetpack' ) }
github Automattic / wp-calypso / client / components / wizard / progress-indicator.jsx View on Github external
const ProgressIndicator = ( { stepNumber, totalSteps } ) =&gt; {
	const translate = useTranslate();

	return (
		<div data-e2e-type="{">
			{ translate( 'Step %(stepNumber)d of %(stepTotal)d', {
				args: {
					stepNumber: stepNumber + 1,
					stepTotal: totalSteps,
				},
			} ) }
		</div>
	);
};
github Automattic / wp-calypso / client / my-sites / marketing / tools / google-adwords.tsx View on Github external
export const MarketingToolsGoogleAdwordsFeature: FunctionComponent&lt; ConnectedProps &gt; = ( {
	isAtomic,
	isJetpack,
	isPremiumOrHigher,
	recordTracksEvent,
	showCard,
	siteId,
	siteSlug,
} ) =&gt; {
	const translate = useTranslate();
	if ( ! showCard || ( isJetpack &amp;&amp; ! isAtomic ) || ! siteId || ! siteSlug ) {
		return null;
	}

	const handleUpgradeClick = () =&gt; {
		recordTracksEvent( 'calypso_marketing_tools_adwords_plan_upgrade_button_click' );
		page( addQueryArgs( { plan: PLAN_PREMIUM }, `/plans/${ siteSlug }` ) );
	};

	const renderButton = () =&gt; {
		if ( isPremiumOrHigher ) {
			return ;
		}
		return (
			<button>
				{ translate( 'Upgrade to Premium' ) }</button>
github Automattic / wp-calypso / packages / composite-checkout-wpcom / src / components / wp-order-review-line-items.js View on Github external
function WPLineItem( { item, className, hasDeleteButtons, removeItem } ) {
	const translate = useTranslate();
	const hasDomainsInCart = useHasDomainsInCart();
	const itemSpanId = `checkout-line-item-${ item.id }`;
	const deleteButtonId = `checkout-delete-button-${ item.id }`;
	const [ isModalVisible, setIsModalVisible ] = useState( false );
	const modalCopy = returnModalCopy( item.type, translate, hasDomainsInCart );

	return (
		<div>
			{ item.label }
			<span aria-labelledby="{">
				{ renderDisplayValueMarkdown( item.amount.displayValue ) }
			</span>
			{ hasDeleteButtons &amp;&amp; item.type !== 'tax' &amp;&amp; (
				
					</div>
github Automattic / wp-calypso / client / my-sites / domains / components / domain-warnings / pending-gsuite-tos-notice-dialog.jsx View on Github external
function PendingGSuiteTosNoticeDialog( props ) {
	const [ password, setPassword ] = useState( false );
	const [ isCopied, setIsCopied ] = useState( false );
	const [ openTracked, setOpenTracked ] = useState( false );
	const translate = useTranslate();

	const trackEvent = ( message, tracksEvent ) => {
		props.trackEvent( {
			domainName: props.domainName,
			message,
			section: props.section,
			siteSlug: props.siteSlug,
			tracksEvent,
			user: props.user,
		} );
	};

	if ( props.visible && ! openTracked ) {
		trackEvent(
			`Opened G Suite "ToS Dialog" via ${ props.section }`,
			'calypso_domain_management_gsuite_pending_account_open_dialog'
github Automattic / wp-calypso / client / components / upgrades / gsuite / gsuite-upsell-card / index.jsx View on Github external
const GSuiteUpsellCard = ( {
	currencyCode,
	domain,
	gSuiteCost,
	gSuiteProductSlug,
	onAddEmailClick,
	onSkipClick,
	recordTracksEvent,
} ) => {
	const [ users, setUsers ] = useState( newUsers( domain ) );

	const canContinue = areAllUsersValid( users );
	const translate = useTranslate();

	const recordClickEvent = eventName => {
		recordTracksEvent( eventName, {
			domain_name: domain,
			user_count: users.length,
		} );
	};

	const recordUsersChangedEvent = ( previousUsers, nextUsers ) => {
		if ( previousUsers.length !== nextUsers.length ) {
			recordTracksEvent( 'calypso_checkout_gsuite_upgrade_users_changed', {
				domain_name: domain,
				next_user_count: nextUsers.length,
				prev_user_count: previousUsers.length,
			} );
		}
github Automattic / wp-calypso / client / my-sites / email / email-management / gsuite-user-item / index.jsx View on Github external
function GSuiteUserItem( props ) {
	const translate = useTranslate();
	const [ dialogVisible, setDialogVisible ] = useState( false );
	const onFixClickHandler = e => {
		e.preventDefault();
		setDialogVisible( true );
	};
	const onCloseClickHandler = () => {
		setDialogVisible( false );
	};

	const getLoginLink = () => {
		const { email, domain } = props.user;
		return `https://accounts.google.com/AccountChooser?Email=${ email }&service=CPanel&continue=https://admin.google.com/a/${ domain }`;
	};

	const renderManage = () => {
		return (