diff --git a/app/soapbox/features/account/components/header.tsx b/app/soapbox/features/account/components/header.tsx index 48c1eff8f..af6e3d079 100644 --- a/app/soapbox/features/account/components/header.tsx +++ b/app/soapbox/features/account/components/header.tsx @@ -67,6 +67,7 @@ const messages = defineMessages({ userEndorsed: { id: 'account.endorse.success', defaultMessage: 'You are now featuring @{acct} on your profile' }, userUnendorsed: { id: 'account.unendorse.success', defaultMessage: 'You are no longer featuring @{acct}' }, profileExternal: { id: 'account.profile_external', defaultMessage: 'View profile on {domain}' }, + header: { id: 'account.header.alt', defaultMessage: 'Profile header' }, }); interface IHeader { @@ -556,7 +557,7 @@ const Header: React.FC = ({ account }) => { )} diff --git a/app/soapbox/features/onboarding/steps/avatar-selection-step.tsx b/app/soapbox/features/onboarding/steps/avatar-selection-step.tsx index 936b59a51..f5f9f7274 100644 --- a/app/soapbox/features/onboarding/steps/avatar-selection-step.tsx +++ b/app/soapbox/features/onboarding/steps/avatar-selection-step.tsx @@ -1,6 +1,6 @@ import classNames from 'clsx'; import React from 'react'; -import { FormattedMessage } from 'react-intl'; +import { defineMessages, FormattedMessage } from 'react-intl'; import { useDispatch } from 'react-redux'; import { patchMe } from 'soapbox/actions/me'; @@ -11,6 +11,10 @@ import resizeImage from 'soapbox/utils/resize-image'; import type { AxiosError } from 'axios'; +const messages = defineMessages({ + error: { id: 'onboarding.error', defaultMessage: 'An unexpected error occurred. Please try again or skip this step.' }, +}); + /** Default avatar filenames from various backends */ const DEFAULT_AVATARS = [ '/avatars/original/missing.png', // Mastodon @@ -64,7 +68,7 @@ const AvatarSelectionStep = ({ onNext }: { onNext: () => void }) => { if (error.response?.status === 422) { dispatch(snackbar.error((error.response.data as any).error.replace('Validation failed: ', ''))); } else { - dispatch(snackbar.error('An unexpected error occurred. Please try again or skip this step.')); + dispatch(snackbar.error(messages.error)); } }); }).catch(console.error); diff --git a/app/soapbox/features/onboarding/steps/bio-step.tsx b/app/soapbox/features/onboarding/steps/bio-step.tsx index 77205b001..38ec425ad 100644 --- a/app/soapbox/features/onboarding/steps/bio-step.tsx +++ b/app/soapbox/features/onboarding/steps/bio-step.tsx @@ -11,6 +11,7 @@ import type { AxiosError } from 'axios'; const messages = defineMessages({ bioPlaceholder: { id: 'onboarding.bio.placeholder', defaultMessage: 'Tell the world a little about yourself…' }, + error: { id: 'onboarding.error', defaultMessage: 'An unexpected error occurred. Please try again or skip this step.' }, }); const BioStep = ({ onNext }: { onNext: () => void }) => { @@ -37,7 +38,7 @@ const BioStep = ({ onNext }: { onNext: () => void }) => { if (error.response?.status === 422) { setErrors([(error.response.data as any).error.replace('Validation failed: ', '')]); } else { - dispatch(snackbar.error('An unexpected error occurred. Please try again or skip this step.')); + dispatch(snackbar.error(messages.error)); } }); }; diff --git a/app/soapbox/features/onboarding/steps/cover-photo-selection-step.tsx b/app/soapbox/features/onboarding/steps/cover-photo-selection-step.tsx index e753a935b..e1a9c5f30 100644 --- a/app/soapbox/features/onboarding/steps/cover-photo-selection-step.tsx +++ b/app/soapbox/features/onboarding/steps/cover-photo-selection-step.tsx @@ -1,6 +1,6 @@ import classNames from 'clsx'; import React from 'react'; -import { FormattedMessage } from 'react-intl'; +import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import { useDispatch } from 'react-redux'; import { patchMe } from 'soapbox/actions/me'; @@ -12,6 +12,11 @@ import resizeImage from 'soapbox/utils/resize-image'; import type { AxiosError } from 'axios'; +const messages = defineMessages({ + header: { id: 'account.header.alt', defaultMessage: 'Profile header' }, + error: { id: 'onboarding.error', defaultMessage: 'An unexpected error occurred. Please try again or skip this step.' }, +}); + /** Default header filenames from various backends */ const DEFAULT_HEADERS = [ '/headers/original/missing.png', // Mastodon @@ -24,6 +29,7 @@ const isDefaultHeader = (url: string) => { }; const CoverPhotoSelectionStep = ({ onNext }: { onNext: () => void }) => { + const intl = useIntl(); const dispatch = useDispatch(); const account = useOwnAccount(); @@ -65,7 +71,7 @@ const CoverPhotoSelectionStep = ({ onNext }: { onNext: () => void }) => { if (error.response?.status === 422) { dispatch(snackbar.error((error.response.data as any).error.replace('Validation failed: ', ''))); } else { - dispatch(snackbar.error('An unexpected error occurred. Please try again or skip this step.')); + dispatch(snackbar.error(messages.error)); } }); }).catch(console.error); @@ -90,7 +96,6 @@ const CoverPhotoSelectionStep = ({ onNext }: { onNext: () => void }) => {
- {/* eslint-disable-next-line jsx-a11y/interactive-supports-focus */}
void }) => { {selectedFile || account?.header && ( )} diff --git a/app/soapbox/features/onboarding/steps/display-name-step.tsx b/app/soapbox/features/onboarding/steps/display-name-step.tsx index 25dd49ba6..5d2e101b2 100644 --- a/app/soapbox/features/onboarding/steps/display-name-step.tsx +++ b/app/soapbox/features/onboarding/steps/display-name-step.tsx @@ -11,6 +11,7 @@ import type { AxiosError } from 'axios'; const messages = defineMessages({ usernamePlaceholder: { id: 'onboarding.display_name.placeholder', defaultMessage: 'Eg. John Smith' }, + error: { id: 'onboarding.error', defaultMessage: 'An unexpected error occurred. Please try again or skip this step.' }, }); const DisplayNameStep = ({ onNext }: { onNext: () => void }) => { @@ -48,7 +49,7 @@ const DisplayNameStep = ({ onNext }: { onNext: () => void }) => { if (error.response?.status === 422) { setErrors([(error.response.data as any).error.replace('Validation failed: ', '')]); } else { - dispatch(snackbar.error('An unexpected error occurred. Please try again or skip this step.')); + dispatch(snackbar.error(messages.error)); } }); }; diff --git a/app/soapbox/features/verification/registration.tsx b/app/soapbox/features/verification/registration.tsx index 4d6edbc6d..6539ca8c8 100644 --- a/app/soapbox/features/verification/registration.tsx +++ b/app/soapbox/features/verification/registration.tsx @@ -18,7 +18,7 @@ import type { AxiosError } from 'axios'; const messages = defineMessages({ success: { id: 'registrations.success', defaultMessage: 'Welcome to {siteTitle}!' }, usernameLabel: { id: 'registrations.username.label', defaultMessage: 'Your username' }, - usernameHint: { id: 'registrations.username.hint', defaultMessage: 'May only contain A-Z, 0-9, and underscores', }, + usernameHint: { id: 'registrations.username.hint', defaultMessage: 'May only contain A-Z, 0-9, and underscores' }, usernameTaken: { id: 'registrations.unprocessable_entity', defaultMessage: 'This username has already been taken.' }, passwordLabel: { id: 'registrations.password.label', defaultMessage: 'Password' }, error: { id: 'registrations.error', defaultMessage: 'Failed to register your account.' }, diff --git a/app/soapbox/features/verification/steps/__tests__/email-verification.test.tsx b/app/soapbox/features/verification/steps/__tests__/email-verification.test.tsx index 9e05686b7..fc9131b97 100644 --- a/app/soapbox/features/verification/steps/__tests__/email-verification.test.tsx +++ b/app/soapbox/features/verification/steps/__tests__/email-verification.test.tsx @@ -23,7 +23,7 @@ describe('', () => { it('successfully submits', async() => { render(); - await userEvent.type(screen.getByLabelText('Email Address'), 'foo@bar.com{enter}'); + await userEvent.type(screen.getByLabelText('E-mail address'), 'foo@bar.com{enter}'); await waitFor(() => { fireEvent.submit( @@ -50,7 +50,7 @@ describe('', () => { it('renders errors', async() => { render(); - await userEvent.type(screen.getByLabelText('Email Address'), 'foo@bar.com{enter}'); + await userEvent.type(screen.getByLabelText('E-mail address'), 'foo@bar.com{enter}'); await waitFor(() => { fireEvent.submit( diff --git a/app/soapbox/locales/en.json b/app/soapbox/locales/en.json index b7c280137..bac5c3ea6 100644 --- a/app/soapbox/locales/en.json +++ b/app/soapbox/locales/en.json @@ -432,7 +432,7 @@ "emoji_button.objects": "Objects", "emoji_button.people": "People", "emoji_button.recent": "Frequently used", - "emoji_button.search": "Search...", + "emoji_button.search": "Search…", "emoji_button.search_results": "Search results", "emoji_button.symbols": "Symbols", "emoji_button.travel": "Travel & Places", @@ -1071,7 +1071,7 @@ "upload_form.description": "Describe for the visually impaired", "upload_form.preview": "Preview", "upload_form.undo": "Delete", - "upload_progress.label": "Uploading...", + "upload_progress.label": "Uploading…", "video.close": "Close video", "video.download": "Download file", "video.exit_fullscreen": "Exit full screen",