// Dependencies import { siteConfig } from 'site/site.config.mjs' import translators from 'site/prebuild/translators.json' // Context import { LoadingContext } from 'shared/context/loading-context.mjs' // Hooks import { useAccount } from 'shared/hooks/use-account.mjs' import { useBackend } from 'shared/hooks/use-backend.mjs' import { useToast } from 'shared/hooks/use-toast.mjs' import { useState, useContext } from 'react' import { useTranslation } from 'next-i18next' // Components import { ChoiceButton } from 'shared/components/choice-button.mjs' import { I18nIcon } from 'shared/components/icons.mjs' import { Popout } from 'shared/components/popout.mjs' import { WebLink } from 'shared/components/web-link.mjs' export const ns = ['translation', 'locales'] /* * Note that this is not a list of all languages. * Instead it is a list of languages that are supported by DeepL * and not yet available (Our Crowdin is integrated with DeepL. */ const languages = [ 'Bulgarian', 'Chinese (simplified)', 'Czech', 'Danish', 'Estonian', 'Finnish', 'Greek', 'Hungarian', 'Indonesian', 'Italian', 'Japanese', 'Korean', 'Latvian', 'Lithuanian', 'Norwegian', 'Polish', 'Portuguese', 'Romanian', 'Russian', 'Slovak', 'Slovenian', 'Swedish', 'Turkish', ] const TeamList = ({ language, t }) => { const count = Object.keys(translators[language]).length return ( <> {Object.keys(translators[language]) .sort() .map((name, i) => ( {name} {i < count - 2 ? ', ' : i < count - 1 ? ' & ' : ' '} ))} ) } export const SuggestLanguageForm = () => { // Context const { loading, startLoading, stopLoading } = useContext(LoadingContext) // Hooks const { t } = useTranslation(ns) const { account, setAccount, token } = useAccount() const backend = useBackend(token) const toast = useToast() // State const [language, setLanguage] = useState(false) const [sent, setSent] = useState(false) const [help, setHelp] = useState(0) const [friends, setFriends] = useState(0) const [comments, setComments] = useState('') const sendSuggestion = async () => { startLoading() const result = await backend.sendLanguageSuggestion({ language, help, friends, comments }) if (result.success) { setSent(true) stopLoading() toast.success('Suggestion submitted') } else { toast.for.backendError() } } if (sent) return ( <>
Suggestion submitted

We will get back to you shortly. Thank you for taking an interest in bringing FreeSewing to more people, specifically the {language} community.

) return ( <>
In what language would you like make FreeSewing available?
{language ? ( <>
Do you plan to (help) translate FreeSewing to this language yourself?
setHelp(1)} active={help === 1}> I am able and willing to help out with translation setHelp(-1)} active={help === -1} > I do not intent to help out with translation
) : (
Are you looking to suggest a language that is not in the list?

The list of languages above does obviously not include all languages. Instead, it is limimted to the list of langauges that are supported by{' '} , a machine-learning tool that can help translators with suggestions that make for an efficient translation experience.

It is always possible to translate to another language by translating everything by hand. However, we estimate that the amount of people out there who are willing to take on such a task is a rounding error.

If you are committed to translating FreeSewing to a language not in the list above, please .

)} {language && help < 0 && (
Thank you for your suggestion

We appreciate that you would like to see FreeSewing translated to {language}.
However, since you are unable to make a commitment yourself, we will not process your suggestion.

We rely on the community to provide translation. We encourage you to find people in the{' '} {language} maker/sewing community who may want to take an active part in translating FreeSewing into {language}.

You can then send those people to this same page to suggest {language} again.

)} {language && help > 0 && ( <>
Do you have friends who can help?
setFriends(1)} active={friends === 1} > And they want to help out too! setFriends(-1)} active={friends === -1} > But maybe others will join my effort?
)} {language && help > 0 && friends !== 0 && ( <>
Any comments you would like to add?