Make more strings localizable

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
ads-account
marcin mikołajczak 2022-11-26 16:00:54 +01:00
rodzic 8b4390681b
commit 34aee08a09
8 zmienionych plików z 26 dodań i 14 usunięć

Wyświetl plik

@ -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<IHeader> = ({ account }) => {
<a href={account.header} onClick={handleHeaderClick} target='_blank'>
<StillImage
src={account.header}
alt='Profile Header'
alt={intl.formatMessage(messages.header)}
/>
</a>
)}

Wyświetl plik

@ -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);

Wyświetl plik

@ -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));
}
});
};

Wyświetl plik

@ -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 }) => {
<div className='sm:pt-10 sm:w-2/3 md:w-1/2 mx-auto'>
<Stack space={10}>
<div className='border border-solid border-gray-200 dark:border-gray-800 rounded-lg'>
{/* eslint-disable-next-line jsx-a11y/interactive-supports-focus */}
<div
role='button'
className='relative h-24 bg-gray-200 dark:bg-gray-800 rounded-t-md flex items-center justify-center'
@ -98,7 +103,7 @@ const CoverPhotoSelectionStep = ({ onNext }: { onNext: () => void }) => {
{selectedFile || account?.header && (
<StillImage
src={selectedFile || account.header}
alt='Profile Header'
alt={intl.formatMessage(messages.header)}
className='absolute inset-0 object-cover rounded-t-md'
/>
)}

Wyświetl plik

@ -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));
}
});
};

Wyświetl plik

@ -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.' },

Wyświetl plik

@ -23,7 +23,7 @@ describe('<EmailVerification />', () => {
it('successfully submits', async() => {
render(<EmailVerification />);
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('<EmailVerification />', () => {
it('renders errors', async() => {
render(<EmailVerification />);
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(

Wyświetl plik

@ -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",