<commit_before>import { c, msgid } from 'ttag';

import { Loader, FullLoader, TextLoader } from '../../../components';

interface Props {
    calendarsToBeCreated: number;
    createdCalendars: number;
    isLoadingOAuth: boolean;
    isLoadingCreateCalendars: boolean;
    isLoadingStartImportTask: boolean;
}

const IALoadingStep = ({
    calendarsToBeCreated,
    createdCalendars,
    isLoadingOAuth,
    isLoadingCreateCalendars,
    isLoadingStartImportTask,
}: Props) => {
    if (!isLoadingOAuth && !isLoadingCreateCalendars && !isLoadingStartImportTask) {
        return <Loader />;
    }

    const contentRenderer = () => {
        if (isLoadingOAuth) {
            return (
                <>
                    <h4>{c('Loading info').t`Gathering your data`}</h4>
                    <TextLoader>{c('Loading info').t`We're gathering your data from your provider`}</TextLoader>
                </>
            );
        }

        // translator: the variable here are numbers, e.g. "3 of 5 created"
        const progressCopy =
            calendarsToBeCreated === 1
                ? c('Loading info').ngettext(
                      msgid`${createdCalendars} of 1 created`,
                      `${createdCalendars} of 1 created`,
                      createdCalendars
                  )
                : c('Loading info').ngettext(
                      msgid`${createdCalendars} of ${calendarsToBeCreated} created`,
                      `${createdCalendars} of ${calendarsToBeCreated} created`,
                      createdCalendars
                  );
        if (isLoadingCreateCalendars) {
            return (
                <>
                    <h4>{c('Loading info').t`Creating new calendars`}</h4>
                    <TextLoader>{progressCopy}</TextLoader>
                </>
            );
        }

        if (isLoadingStartImportTask) {
            return (
                <>
                    <h4>{c('Loading info').t`Your import is starting`}</h4>
                    <TextLoader>{c('Loading info').t`Almost there`}</TextLoader>
                </>
            );
        }

        return null;
    };

    return (
        <div className="p1 text-center w100">
            <FullLoader size={100} className="mb1" />
            {contentRenderer()}
        </div>
    );
};

export default IALoadingStep;<commit_msg>Simplify translation to avoid involving multi-variable plurals<commit_after>import { c } from 'ttag';

import { Loader, FullLoader, TextLoader } from '../../../components';

interface Props {
    calendarsToBeCreated: number;
    createdCalendars: number;
    isLoadingOAuth: boolean;
    isLoadingCreateCalendars: boolean;
    isLoadingStartImportTask: boolean;
}

const IALoadingStep = ({
    calendarsToBeCreated,
    createdCalendars,
    isLoadingOAuth,
    isLoadingCreateCalendars,
    isLoadingStartImportTask,
}: Props) => {
    if (!isLoadingOAuth && !isLoadingCreateCalendars && !isLoadingStartImportTask) {
        return <Loader />;
    }

    const contentRenderer = () => {
        if (isLoadingOAuth) {
            return (
                <>
                    <h4>{c('Loading info').t`Gathering your data`}</h4>
                    <TextLoader>{c('Loading info').t`We're gathering your data from your provider`}</TextLoader>
                </>
            );
        }

        // translator: the variables here are numbers, e.g. "Amount of calendars created: 3 out of 5"
        const progressCopy = c('Loading info')
            .t`Amount of calendars created: ${createdCalendars} out of ${calendarsToBeCreated}`;
        if (isLoadingCreateCalendars) {
            return (
                <>
                    <h4>{c('Loading info').t`Creating new calendars`}</h4>
                    <TextLoader>{progressCopy}</TextLoader>
                </>
            );
        }

        if (isLoadingStartImportTask) {
            return (
                <>
                    <h4>{c('Loading info').t`Your import is starting`}</h4>
                    <TextLoader>{c('Loading info').t`Almost there`}</TextLoader>
                </>
            );
        }

        return null;
    };

    return (
        <div className="p1 text-center w100">
            <FullLoader size={100} className="mb1" />
            {contentRenderer()}
        </div>
    );
};

export default IALoadingStep;
{'fraction_non_alphanumeric': 0.11850835049187829, 'fraction_numerical': 0.008007320979180966, 'mean_word_length': 1.7479572595851665, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 51, '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': '6202425', 'n_tokens_mistral': 1245, 'n_tokens_neox': 1170, 'n_words': 244}