fix: add translated close button label in alert messages (#43810)
This commit is contained in:
@ -36,7 +36,11 @@ function DonateCompletion({
|
|||||||
: `${t('donate.error')}`;
|
: `${t('donate.error')}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Alert bsStyle={style} className='donation-completion'>
|
<Alert
|
||||||
|
bsStyle={style}
|
||||||
|
className='donation-completion'
|
||||||
|
closeLabel={t('buttons.close')}
|
||||||
|
>
|
||||||
<h4>
|
<h4>
|
||||||
<b>{heading}</b>
|
<b>{heading}</b>
|
||||||
</h4>
|
</h4>
|
||||||
|
@ -43,6 +43,7 @@ function Flash({ flashMessage, onClose }: FlashProps): JSX.Element {
|
|||||||
<Alert
|
<Alert
|
||||||
bsStyle={type}
|
bsStyle={type}
|
||||||
className='flash-message'
|
className='flash-message'
|
||||||
|
closeLabel={t('buttons.close')}
|
||||||
onDismiss={handleClose}
|
onDismiss={handleClose}
|
||||||
>
|
>
|
||||||
{t(message, variables)}
|
{t(message, variables)}
|
||||||
|
@ -11,6 +11,7 @@ import normalizeUrl from 'normalize-url';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Field } from 'react-final-form';
|
import { Field } from 'react-final-form';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
import {
|
import {
|
||||||
editorValidator,
|
editorValidator,
|
||||||
localhostValidator,
|
localhostValidator,
|
||||||
@ -34,6 +35,7 @@ const propTypes = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function FormFields(props) {
|
function FormFields(props) {
|
||||||
|
const { t } = useTranslation();
|
||||||
const { formFields, options = {} } = props;
|
const { formFields, options = {} } = props;
|
||||||
const {
|
const {
|
||||||
ignored = [],
|
ignored = [],
|
||||||
@ -62,7 +64,10 @@ function FormFields(props) {
|
|||||||
const message = error || validationError || validationWarning;
|
const message = error || validationError || validationWarning;
|
||||||
return message ? (
|
return message ? (
|
||||||
<HelpBlock>
|
<HelpBlock>
|
||||||
<Alert bsStyle={error || validationError ? 'danger' : 'info'}>
|
<Alert
|
||||||
|
bsStyle={error || validationError ? 'danger' : 'info'}
|
||||||
|
closeLabel={t('buttons.close')}
|
||||||
|
>
|
||||||
{message}
|
{message}
|
||||||
</Alert>
|
</Alert>
|
||||||
</HelpBlock>
|
</HelpBlock>
|
||||||
|
@ -157,7 +157,9 @@ class AboutSettings extends Component<AboutProps, AboutState> {
|
|||||||
if (this.state.isPictureUrlValid === false) {
|
if (this.state.isPictureUrlValid === false) {
|
||||||
return (
|
return (
|
||||||
<HelpBlock>
|
<HelpBlock>
|
||||||
<Alert bsStyle='info'>{t('validation.url-not-image')}</Alert>
|
<Alert bsStyle='info' closeLabel={t('buttons.close')}>
|
||||||
|
{t('validation.url-not-image')}
|
||||||
|
</Alert>
|
||||||
</HelpBlock>
|
</HelpBlock>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -182,7 +182,11 @@ class EmailSettings extends Component<EmailProps, EmailState> {
|
|||||||
{isEmailVerified ? null : (
|
{isEmailVerified ? null : (
|
||||||
<FullWidthRow>
|
<FullWidthRow>
|
||||||
<HelpBlock>
|
<HelpBlock>
|
||||||
<Alert bsStyle='info' className='text-center'>
|
<Alert
|
||||||
|
bsStyle='info'
|
||||||
|
className='text-center'
|
||||||
|
closeLabel={t('buttons.close')}
|
||||||
|
>
|
||||||
{t('settings.email.not-verified')}
|
{t('settings.email.not-verified')}
|
||||||
<br />
|
<br />
|
||||||
<Trans i18nKey='settings.email.check'>
|
<Trans i18nKey='settings.email.check'>
|
||||||
|
@ -152,7 +152,7 @@ class UsernameSettings extends Component<UsernameProps, UsernameState> {
|
|||||||
console.log(error);
|
console.log(error);
|
||||||
return (
|
return (
|
||||||
<FullWidthRow>
|
<FullWidthRow>
|
||||||
<Alert bsStyle='danger'>
|
<Alert bsStyle='danger' closeLabel={t('buttons.close')}>
|
||||||
{t(`settings.username.${error}`, {
|
{t(`settings.username.${error}`, {
|
||||||
username: this.state.formValue
|
username: this.state.formValue
|
||||||
})}
|
})}
|
||||||
@ -163,28 +163,38 @@ class UsernameSettings extends Component<UsernameProps, UsernameState> {
|
|||||||
if (!validating && !isValidUsername) {
|
if (!validating && !isValidUsername) {
|
||||||
return (
|
return (
|
||||||
<FullWidthRow>
|
<FullWidthRow>
|
||||||
<Alert bsStyle='warning'>{t('settings.username.unavailable')}</Alert>
|
<Alert bsStyle='warning' closeLabel={t('buttons.close')}>
|
||||||
|
{t('settings.username.unavailable')}
|
||||||
|
</Alert>
|
||||||
</FullWidthRow>
|
</FullWidthRow>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (validating) {
|
if (validating) {
|
||||||
return (
|
return (
|
||||||
<FullWidthRow>
|
<FullWidthRow>
|
||||||
<Alert bsStyle='info'>{t('settings.username.validating')}</Alert>
|
<Alert bsStyle='info' closeLabel={t('buttons.close')}>
|
||||||
|
{t('settings.username.validating')}
|
||||||
|
</Alert>
|
||||||
</FullWidthRow>
|
</FullWidthRow>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!validating && isValidUsername && this.state.isUserNew) {
|
if (!validating && isValidUsername && this.state.isUserNew) {
|
||||||
return (
|
return (
|
||||||
<FullWidthRow>
|
<FullWidthRow>
|
||||||
<Alert bsStyle='success'>{t('settings.username.available')}</Alert>
|
<Alert bsStyle='success' closeLabel={t('buttons.close')}>
|
||||||
|
{t('settings.username.available')}
|
||||||
|
</Alert>
|
||||||
</FullWidthRow>
|
</FullWidthRow>
|
||||||
);
|
);
|
||||||
} else if (!validating && isValidUsername && !this.state.isUserNew) {
|
} else if (!validating && isValidUsername && !this.state.isUserNew) {
|
||||||
return (
|
return (
|
||||||
<FullWidthRow>
|
<FullWidthRow>
|
||||||
<Alert bsStyle='success'>{t('settings.username.available')}</Alert>
|
<Alert bsStyle='success' closeLabel={t('buttons.close')}>
|
||||||
<Alert bsStyle='info'>{t('settings.username.change')}</Alert>
|
{t('settings.username.available')}
|
||||||
|
</Alert>
|
||||||
|
<Alert bsStyle='info' closeLabel={t('buttons.close')}>
|
||||||
|
{t('settings.username.change')}
|
||||||
|
</Alert>
|
||||||
</FullWidthRow>
|
</FullWidthRow>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ function DonatePage({
|
|||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
{isDonating ? (
|
{isDonating ? (
|
||||||
<Alert>
|
<Alert closeLabel={t('buttons.close')}>
|
||||||
<p>{t('donate.thank-you-2')}</p>
|
<p>{t('donate.thank-you-2')}</p>
|
||||||
<br />
|
<br />
|
||||||
<DonationOptionsAlertText />
|
<DonationOptionsAlertText />
|
||||||
|
Reference in New Issue
Block a user