<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import { Text } from '@buffetjs/core';
import { ModalConfirm } from '@strapi/helper-plugin';
import { useIntl } from 'react-intl';
import useDeleteLocale from '../../hooks/useDeleteLocale';
import { getTrad } from '../../utils';

const ModalDelete = ({ localeToDelete, onClose }) => {
  const { isDeleting, deleteLocale } = useDeleteLocale();
  const { formatMessage } = useIntl();
  const isOpened = Boolean(localeToDelete);

  const handleDelete = () => deleteLocale(localeToDelete.id).then(onClose);

  return (
    <ModalConfirm
      confirmButtonLabel={{
        id: getTrad('Settings.locales.modal.delete.confirm'),
      }}
      showButtonLoader={isDeleting}
      isOpen={isOpened}
      toggle={onClose}
      onClosed={onClose}
      onConfirm={handleDelete}
      type="warning"
      content={{
        id: getTrad(`Settings.locales.modal.delete.message`),
      }}
    >
      <Text fontWeight="bold">
        {formatMessage({ id: getTrad('Settings.locales.modal.delete.secondMessage') })}
      </Text>
    </ModalConfirm>
  );
};

ModalDelete.defaultProps = {
  localeToDelete: undefined,
};

ModalDelete.propTypes = {
  localeToDelete: PropTypes.shape({
    id: PropTypes.number.isRequired,<commit_msg>Delete locale with parts<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import { ConfirmDialog } from '@strapi/helper-plugin';
import useDeleteLocale from '../../hooks/useDeleteLocale';

const ModalDelete = ({ localeToDelete, onClose }) => {
  const { isDeleting, deleteLocale } = useDeleteLocale();
  const isOpened = Boolean(localeToDelete);

  const handleDelete = () => deleteLocale(localeToDelete.id).then(onClose);

  return (
    <ConfirmDialog
      isConfirmButtonLoading={isDeleting}
      onConfirm={handleDelete}
      onToggleDialog={onClose}
      isOpen={isOpened}
    />
  );
};

ModalDelete.defaultProps = {
  localeToDelete: undefined,
};

ModalDelete.propTypes = {
  localeToDelete: PropTypes.shape({
    id: PropTypes.number.isRequired,
{'fraction_non_alphanumeric': 0.13778204512722037, 'fraction_numerical': 0.0, 'mean_word_length': 3.9267139479905437, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6742914', 'n_tokens_mistral': 621, 'n_tokens_neox': 628, 'n_words': 120}