Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin Page: better handle i18n for disconnection warnings #18392

Merged
merged 1 commit into from Jan 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
* WordPress dependencies
*/
import { createInterpolateElement } from '@wordpress/element';
import { __, _n } from '@wordpress/i18n';
import { __, _n, sprintf } from '@wordpress/i18n';

/**
* Internal dependencies
Expand Down Expand Up @@ -110,11 +110,26 @@ class JetpackTerminationDialogFeatures extends Component {

render() {
const { isDevVersion, purpose, siteBenefits, connectedPlugins } = this.props;

const siteBenefitCount = siteBenefits.length;

const jetpackSupportURl = isDevVersion ? JETPACK_CONTACT_BETA_SUPPORT : JETPACK_CONTACT_SUPPORT;

const connectedPluginsTitle =
1 === connectedPlugins.length
? __(
'The Jetpack Connection is also used by another plugin, and it will lose connection.',
'jetpack'
)
: sprintf(
/* translators: placeholder is a number. */
_n(
'The Jetpack Connection is also used by %d other plugin, and it will lose connection.',
kraftbj marked this conversation as resolved.
Show resolved Hide resolved
'The Jetpack Connection is also used by %d other plugins, and they will lose connection.',
connectedPlugins.length,
'jetpack'
),
connectedPlugins.length
);

return (
<Card className="jetpack-termination-dialog__features">
<p className="jetpack-termination-dialog__info">
Expand Down Expand Up @@ -164,14 +179,7 @@ class JetpackTerminationDialogFeatures extends Component {
) }
{ connectedPlugins.length > 0 && (
<div className="jetpack-termination-dialog__generic-info">
<h2>
{ _n(
'The Jetpack Connection is also used by another plugin, and it will lose connection.',
'The Jetpack Connection is also used by other plugins, and they will lose connection.',
connectedPlugins.length,
'jetpack'
) }
</h2>
<h2>{ connectedPluginsTitle }</h2>
{ this.renderConnectedPlugins( connectedPlugins ) }
</div>
) }
Expand Down