Add missing strings to translation, enable formatjs ESLint rules

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-03-25 12:40:07 +01:00
parent 5ea2e2442c
commit 9585b3a870
20 changed files with 220 additions and 62 deletions

View File

@@ -92,7 +92,7 @@ const messages = defineMessages({
redraftMessage: { id: 'confirmations.redraft.message', defaultMessage: 'Are you sure you want to delete this post and re-draft it? Favorites and reposts will be lost, and replies to the original post will be orphaned.' },
replies_disabled_group: { id: 'status.disabled_replies.group_membership', defaultMessage: 'Only group members can reply' },
reply: { id: 'status.reply', defaultMessage: 'Reply' },
replyAll: { id: 'status.replyAll', defaultMessage: 'Reply to thread' },
replyAll: { id: 'status.reply_all', defaultMessage: 'Reply to thread' },
replyConfirm: { id: 'confirmations.reply.confirm', defaultMessage: 'Reply' },
replyMessage: { id: 'confirmations.reply.message', defaultMessage: 'Replying now will overwrite the message you are currently composing. Are you sure you want to proceed?' },
report: { id: 'status.report', defaultMessage: 'Report @{name}' },

View File

@@ -1,6 +1,6 @@
import clsx from 'clsx';
import React from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
import Button from '../button/button';
import { ButtonThemes } from '../button/useButtonStyles';
@@ -145,7 +145,7 @@ const Modal = React.forwardRef<HTMLDivElement, IModal>(({
theme='tertiary'
onClick={cancelAction}
>
{cancelText || 'Cancel'}
{cancelText || <FormattedMessage id='common.cancel' defaultMessage='Cancel' />}
</Button>
)}
</div>

View File

@@ -142,7 +142,7 @@ const Toast = (props: IToast) => {
onClick={dismissToast}
data-testid='toast-dismiss'
>
<span className='sr-only'>Close</span>
<span className='sr-only'><FormattedMessage id='lightbox.close' defaultMessage='Close' /></span>
<Icon src={require('@tabler/icons/x.svg')} className='h-5 w-5' />
</button>
</div>

View File

@@ -11,6 +11,7 @@ import type { AxiosResponse } from 'axios';
const noOp = () => {};
const messages = defineMessages({
captcha: { id: 'registration.captcha', defaultMessage: 'Captcha' },
placeholder: { id: 'registration.captcha.placeholder', defaultMessage: 'Enter the pictured text' },
});
@@ -110,7 +111,7 @@ const NativeCaptchaField: React.FC<INativeCaptchaField> = ({ captcha, onChange,
return (
<Stack space={2}>
<div className='flex w-full items-center justify-center rounded-md border border-solid border-gray-300 bg-white dark:border-gray-600'>
<img alt='captcha' src={captcha.get('url')} onClick={onClick} />
<img alt={intl.formatMessage(messages.captcha)} src={captcha.get('url')} onClick={onClick} />
</div>
<Input

View File

@@ -18,8 +18,8 @@ const messages = defineMessages({
delete: { id: 'chats.actions.delete', defaultMessage: 'Delete for both' },
copy: { id: 'chats.actions.copy', defaultMessage: 'Copy' },
report: { id: 'chats.actions.report', defaultMessage: 'Report' },
deleteForMe: { id: 'chats.actions.deleteForMe', defaultMessage: 'Delete for me' },
blockedBy: { id: 'chat_message_list.blockedBy', defaultMessage: 'You are blocked by' },
deleteForMe: { id: 'chats.actions.delete_for_me', defaultMessage: 'Delete for me' },
blockedBy: { id: 'chat_message_list.blocked_by', defaultMessage: 'You are blocked by' },
networkFailureTitle: { id: 'chat_message_list.network_failure.title', defaultMessage: 'Whoops!' },
networkFailureSubtitle: { id: 'chat_message_list.network_failure.subtitle', defaultMessage: 'We encountered a network failure.' },
networkFailureAction: { id: 'chat_message_list.network_failure.action', defaultMessage: 'Try again' },

View File

@@ -26,7 +26,7 @@ import type { ChatMessage as ChatMessageEntity } from 'soapbox/types/entities';
const messages = defineMessages({
copy: { id: 'chats.actions.copy', defaultMessage: 'Copy' },
delete: { id: 'chats.actions.delete', defaultMessage: 'Delete for both' },
deleteForMe: { id: 'chats.actions.deleteForMe', defaultMessage: 'Delete for me' },
deleteForMe: { id: 'chats.actions.delete_for_me', defaultMessage: 'Delete for me' },
more: { id: 'chats.actions.more', defaultMessage: 'More' },
report: { id: 'chats.actions.report', defaultMessage: 'Report' },
});

View File

@@ -1,6 +1,6 @@
import clsx from 'clsx';
import React, { useEffect, useState } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
import { useLocation } from 'react-router-dom';
import { fetchDirectory, expandDirectory } from 'soapbox/actions/directory';
@@ -53,9 +53,13 @@ const Directory = () => {
<Stack space={4}>
<div className='grid grid-cols-2 gap-2'>
<div>
<Text weight='medium'>Display filter</Text>
<Text weight='medium'>
<FormattedMessage id='directory.display_filter' defaultMessage='Display filter' />
</Text>
<fieldset className='mt-3'>
<legend className='sr-only'>Display filter</legend>
<legend className='sr-only'>
<FormattedMessage id='directory.display_filter' defaultMessage='Display filter' />
</legend>
<div className='space-y-2'>
<RadioButton name='order' value='active' label={intl.formatMessage(messages.recentlyActive)} checked={order === 'active'} onChange={handleChangeOrder} />
<RadioButton name='order' value='new' label={intl.formatMessage(messages.newArrivals)} checked={order === 'new'} onChange={handleChangeOrder} />
@@ -65,9 +69,13 @@ const Directory = () => {
{features.federating && (
<div>
<Text weight='medium'>Fediverse filter</Text>
<Text weight='medium'>
<FormattedMessage id='directory.fediverse_filter' defaultMessage='Fediverse filter' />
</Text>
<fieldset className='mt-3'>
<legend className='sr-only'>Fediverse filter</legend>
<legend className='sr-only'>
<FormattedMessage id='directory.fediverse_filter' defaultMessage='Fediverse filter' />
</legend>
<div className='space-y-2'>
<RadioButton name='local' value='1' label={intl.formatMessage(messages.local, { domain: instance.title })} checked={local} onChange={handleChangeLocal} />
<RadioButton name='local' value='0' label={intl.formatMessage(messages.federated)} checked={!local} onChange={handleChangeLocal} />

View File

@@ -9,7 +9,7 @@ import AccountContainer from 'soapbox/containers/account-container';
import { useAppDispatch, useAppSelector } from 'soapbox/hooks';
const messages = defineMessages({
heading: { id: 'followRecommendations.heading', defaultMessage: 'Suggested Profiles' },
heading: { id: 'follow_recommendations.heading', defaultMessage: 'Suggested Profiles' },
});
const FollowRecommendations: React.FC = () => {

View File

@@ -1,4 +1,5 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { Avatar, Button, CardTitle, Stack } from 'soapbox/components/ui';
import { type Card as StatusCard } from 'soapbox/types/entities';
@@ -28,7 +29,7 @@ const GroupLinkPreview: React.FC<IGroupLinkPreview> = ({ card }) => {
<CardTitle title={<span dangerouslySetInnerHTML={{ __html: group.display_name_html }} />} />
<Button theme='primary' to={`/group/${group.slug}`} block>
View Group
<FormattedMessage id='group.popover.action' defaultMessage='View Group' />
</Button>
</Stack>
</Stack>

View File

@@ -100,7 +100,7 @@ const DetailedStatus: React.FC<IDetailedStatus> = ({
if (actualStatus.pleroma.get('quote_visible', true) === false) {
quote = (
<div className='quoted-actualStatus-tombstone'>
<p><FormattedMessage id='actualStatuses.quote_tombstone' defaultMessage='Post is unavailable.' /></p>
<p><FormattedMessage id='status.quote_tombstone' defaultMessage='Post is unavailable.' /></p>
</div>
);
} else {
@@ -190,7 +190,7 @@ const DetailedStatus: React.FC<IDetailedStatus> = ({
tabIndex={0}
>
<Text tag='span' theme='muted' size='sm'>
<FormattedMessage id='actualStatus.edited' defaultMessage='Edited {date}' values={{ date: intl.formatDate(new Date(actualStatus.edited_at), { hour12: true, month: 'short', day: '2-digit', hour: 'numeric', minute: '2-digit' }) }} />
<FormattedMessage id='status.edited' defaultMessage='Edited {date}' values={{ date: intl.formatDate(new Date(actualStatus.edited_at), { hour12: true, month: 'short', day: '2-digit', hour: 'numeric', minute: '2-digit' }) }} />
</Text>
</div>
</>

View File

@@ -25,6 +25,16 @@ const messages = defineMessages({
export: { id: 'theme_editor.export', defaultMessage: 'Export theme' },
import: { id: 'theme_editor.import', defaultMessage: 'Import theme' },
importSuccess: { id: 'theme_editor.import_success', defaultMessage: 'Theme was successfully imported!' },
colorPrimary: { id: 'theme_editor.colors.primary', defaultMessage: 'Primary' },
colorSecondary: { id: 'theme_editor.colors.secondary', defaultMessage: 'Secondary' },
colorAccent: { id: 'theme_editor.colors.accent', defaultMessage: 'Accent' },
colorGray: { id: 'theme_editor.colors.gray', defaultMessage: 'Gray' },
colorSuccess: { id: 'theme_editor.colors.success', defaultMessage: 'Success' },
colorDanger: { id: 'theme_editor.colors.danger', defaultMessage: 'Danger' },
colorGreentext: { id: 'theme_editor.colors.greentext', defaultMessage: 'Greentext' },
colorAccentBlue: { id: 'theme_editor.colors.accent_blue', defaultMessage: 'Accent Blue' },
colorGradientStart: { id: 'theme_editor.colors.gradient_start', defaultMessage: 'Gradient Start' },
colorGradientEnd: { id: 'theme_editor.colors.gradient_end', defaultMessage: 'Gradient End' },
});
interface IThemeEditor {
@@ -125,42 +135,42 @@ const ThemeEditor: React.FC<IThemeEditor> = () => {
<Form onSubmit={handleSubmit}>
<List>
<PaletteListItem
label='Primary'
label={intl.formatMessage(messages.colorPrimary)}
palette={colors.primary}
onChange={updateColors('primary')}
resetKey={resetKey}
/>
<PaletteListItem
label='Secondary'
label={intl.formatMessage(messages.colorSecondary)}
palette={colors.secondary}
onChange={updateColors('secondary')}
resetKey={resetKey}
/>
<PaletteListItem
label='Accent'
label={intl.formatMessage(messages.colorAccent)}
palette={colors.accent}
onChange={updateColors('accent')}
resetKey={resetKey}
/>
<PaletteListItem
label='Gray'
label={intl.formatMessage(messages.colorGray)}
palette={colors.gray}
onChange={updateColors('gray')}
resetKey={resetKey}
/>
<PaletteListItem
label='Success'
label={intl.formatMessage(messages.colorSuccess)}
palette={colors.success}
onChange={updateColors('success')}
resetKey={resetKey}
/>
<PaletteListItem
label='Danger'
label={intl.formatMessage(messages.colorDanger)}
palette={colors.danger}
onChange={updateColors('danger')}
resetKey={resetKey}
@@ -169,25 +179,25 @@ const ThemeEditor: React.FC<IThemeEditor> = () => {
<List>
<ColorListItem
label='Greentext'
label={intl.formatMessage(messages.colorGreentext)}
value={colors.greentext}
onChange={updateColor('greentext')}
/>
<ColorListItem
label='Accent Blue'
label={intl.formatMessage(messages.colorAccentBlue)}
value={colors['accent-blue']}
onChange={updateColor('accent-blue')}
/>
<ColorListItem
label='Gradient Start'
label={intl.formatMessage(messages.colorGradientStart)}
value={colors['gradient-start']}
onChange={updateColor('gradient-start')}
/>
<ColorListItem
label='Gradient End'
label={intl.formatMessage(messages.colorGradientEnd)}
value={colors['gradient-end']}
onChange={updateColor('gradient-end')}
/>
@@ -210,7 +220,7 @@ const ThemeEditor: React.FC<IThemeEditor> = () => {
}]}
/>
<Button theme='secondary' onClick={resetTheme}>
<FormattedMessage id='theme_editor.Reset' defaultMessage='Reset' />
<FormattedMessage id='theme_editor.reset' defaultMessage='Reset' />
</Button>
<Button type='submit' theme='primary' disabled={submitting}>

View File

@@ -8,7 +8,7 @@ import { useRegistrationStatus, useSoapboxConfig } from 'soapbox/hooks';
const messages = defineMessages({
download: { id: 'landing_page_modal.download', defaultMessage: 'Download' },
helpCenter: { id: 'landing_page_modal.helpCenter', defaultMessage: 'Help Center' },
helpCenter: { id: 'landing_page_modal.help_center', defaultMessage: 'Help Center' },
login: { id: 'header.login.label', defaultMessage: 'Log in' },
register: { id: 'header.register.label', defaultMessage: 'Register' },
});

View File

@@ -22,8 +22,8 @@ const messages = defineMessages({
done: { id: 'report.done', defaultMessage: 'Done' },
next: { id: 'report.next', defaultMessage: 'Next' },
submit: { id: 'report.submit', defaultMessage: 'Submit' },
reportContext: { id: 'report.chatMessage.context', defaultMessage: 'When reporting a users message, the five messages before and five messages after the one selected will be passed along to our moderation team for context.' },
reportMessage: { id: 'report.chatMessage.title', defaultMessage: 'Report message' },
reportContext: { id: 'report.chat_message.context', defaultMessage: 'When reporting a users message, the five messages before and five messages after the one selected will be passed along to our moderation team for context.' },
reportMessage: { id: 'report.chat_message.title', defaultMessage: 'Report message' },
reportGroup: { id: 'report.group.title', defaultMessage: 'Report Group' },
cancel: { id: 'common.cancel', defaultMessage: 'Cancel' },
previous: { id: 'report.previous', defaultMessage: 'Previous' },

View File

@@ -12,11 +12,11 @@ import { getDomain } from 'soapbox/utils/accounts';
import type { Account } from 'soapbox/schemas';
const messages = defineMessages({
addAdditionalStatuses: { id: 'report.otherActions.addAdditional', defaultMessage: 'Would you like to add additional statuses to this report?' },
addMore: { id: 'report.otherActions.addMore', defaultMessage: 'Add more' },
furtherActions: { id: 'report.otherActions.furtherActions', defaultMessage: 'Further actions:' },
hideAdditionalStatuses: { id: 'report.otherActions.hideAdditional', defaultMessage: 'Hide additional statuses' },
otherStatuses: { id: 'report.otherActions.otherStatuses', defaultMessage: 'Include other statuses?' },
addAdditionalStatuses: { id: 'report.other_actions.add_additional', defaultMessage: 'Would you like to add additional statuses to this report?' },
addMore: { id: 'report.other_actions.add_more', defaultMessage: 'Add more' },
furtherActions: { id: 'report.other_actions.further_actions', defaultMessage: 'Further actions:' },
hideAdditionalStatuses: { id: 'report.other_actions.hide_additional', defaultMessage: 'Hide additional statuses' },
otherStatuses: { id: 'report.other_actions.other_statuses', defaultMessage: 'Include other statuses?' },
});
interface IOtherActionsStep {

View File

@@ -15,7 +15,7 @@ interface ITrendsPanel {
const messages = defineMessages({
viewAll: {
id: 'trendsPanel.viewAll',
id: 'trends_panel.view_all',
defaultMessage: 'View all',
},
});

View File

@@ -83,8 +83,6 @@
"account_note.header": "Note",
"account_note.placeholder": "Click to add a note",
"account_search.placeholder": "Search for an account",
"actualStatus.edited": "Edited {date}",
"actualStatuses.quote_tombstone": "Post is unavailable.",
"admin.announcements.action": "Create announcement",
"admin.announcements.all_day": "All day",
"admin.announcements.delete": "Delete",
@@ -234,7 +232,7 @@
"chat_list_item.blocked_you": "This user has blocked you",
"chat_list_item.blocking": "You have blocked this user",
"chat_message_list.blocked": "You blocked this user",
"chat_message_list.blockedBy": "You are blocked by",
"chat_message_list.blocked_by": "You are blocked by",
"chat_message_list.network_failure.action": "Try again",
"chat_message_list.network_failure.subtitle": "We encountered a network failure.",
"chat_message_list.network_failure.title": "Whoops!",
@@ -281,7 +279,7 @@
"chat_window.auto_delete_tooltip": "Chat messages are set to auto-delete after {day, plural, one {# day} other {# days}} upon sending.",
"chats.actions.copy": "Copy",
"chats.actions.delete": "Delete for both",
"chats.actions.deleteForMe": "Delete for me",
"chats.actions.delete_for_me": "Delete for me",
"chats.actions.more": "More",
"chats.actions.report": "Report",
"chats.dividers.today": "Today",
@@ -575,7 +573,9 @@
"developers.settings_store.advanced": "Advanced settings",
"developers.settings_store.hint": "It is possible to directly edit your user settings here. BE CAREFUL! Editing this section can break your account, and you will only be able to recover through the API.",
"direct.search_placeholder": "Send a message to…",
"directory.display_filter": "Display filter",
"directory.federated": "From known fediverse",
"directory.fediverse_filter": "Fediverse filter",
"directory.local": "From {domain} only",
"directory.new_arrivals": "New arrivals",
"directory.recently_active": "Recently active",
@@ -695,9 +695,11 @@
"event.copy": "Copy link to event",
"event.date": "Date",
"event.description": "Description",
"event.discussion": "Discussion",
"event.discussion.empty": "No one has commented this event yet. When someone does, they will appear here.",
"event.export_ics": "Export to your calendar",
"event.external": "View event on {domain}",
"event.information": "Information",
"event.join_state.accept": "Going",
"event.join_state.empty": "Participate",
"event.join_state.pending": "Pending",
@@ -756,7 +758,7 @@
"filters.filters_list_phrases_label": "Keywords or phrases:",
"filters.filters_list_warn": "Display warning",
"filters.removed": "Filter deleted.",
"followRecommendations.heading": "Suggested Profiles",
"follow_recommendations.heading": "Suggested Profiles",
"follow_request.authorize": "Authorize",
"follow_request.reject": "Reject",
"gdpr.accept": "Accept",
@@ -926,7 +928,7 @@
"keyboard_shortcuts.unfocus": "to un-focus compose textarea/search",
"keyboard_shortcuts.up": "to move up in the list",
"landing_page_modal.download": "Download",
"landing_page_modal.helpCenter": "Help Center",
"landing_page_modal.help_center": "Help Center",
"lightbox.close": "Close",
"lightbox.expand": "Expand",
"lightbox.minimize": "Minimize",
@@ -1223,6 +1225,7 @@
"register_invite.lead": "Complete the form below to create an account.",
"register_invite.title": "You've been invited to join {siteTitle}!",
"registration.agreement": "I agree to the {tos}.",
"registration.captcha": "Captcha",
"registration.captcha.hint": "Click the image to get a new captcha",
"registration.captcha.placeholder": "Enter the pictured text",
"registration.closed_message": "{instance} is not accepting new members",
@@ -1280,8 +1283,8 @@
"reply_mentions.reply_empty": "Replying to post",
"report.block": "Block {target}",
"report.block_hint": "Do you also want to block this account?",
"report.chatMessage.context": "When reporting a users message, the five messages before and five messages after the one selected will be passed along to our moderation team for context.",
"report.chatMessage.title": "Report message",
"report.chat_message.context": "When reporting a users message, the five messages before and five messages after the one selected will be passed along to our moderation team for context.",
"report.chat_message.title": "Report message",
"report.confirmation.content": "If we find that this {entity} is violating the {link} we will take further action on the matter.",
"report.confirmation.entity.account": "account",
"report.confirmation.entity.group": "group",
@@ -1291,11 +1294,11 @@
"report.forward_hint": "The account is from another server. Send a copy of the report there as well?",
"report.group.title": "Report Group",
"report.next": "Next",
"report.otherActions.addAdditional": "Would you like to add additional statuses to this report?",
"report.otherActions.addMore": "Add more",
"report.otherActions.furtherActions": "Further actions:",
"report.otherActions.hideAdditional": "Hide additional statuses",
"report.otherActions.otherStatuses": "Include other statuses?",
"report.other_actions.add_additional": "Would you like to add additional statuses to this report?",
"report.other_actions.add_more": "Add more",
"report.other_actions.further_actions": "Further actions:",
"report.other_actions.hide_additional": "Hide additional statuses",
"report.other_actions.other_statuses": "Include other statuses?",
"report.placeholder": "Additional comments",
"report.previous": "Previous",
"report.reason.blankslate": "You have removed all statuses from being selected.",
@@ -1429,6 +1432,7 @@
"status.disabled_replies.group_membership": "Only group members can reply",
"status.disfavourite": "Disike",
"status.edit": "Edit",
"status.edited": "Edited {date}",
"status.embed": "Embed post",
"status.external": "View post on {domain}",
"status.favourite": "Like",
@@ -1449,6 +1453,7 @@
"status.pin_to_group.success": "Pinned to Group!",
"status.pinned": "Pinned post",
"status.quote": "Quote post",
"status.quote_tombstone": "Post is unavailable.",
"status.reactions.cry": "Sad",
"status.reactions.empty": "No one has reacted to this post yet. When someone does, they will show up here.",
"status.reactions.heart": "Love",
@@ -1466,7 +1471,7 @@
"status.remove_account_from_group": "Remove account from group",
"status.remove_post_from_group": "Remove post from group",
"status.reply": "Reply",
"status.replyAll": "Reply to thread",
"status.reply_all": "Reply to thread",
"status.report": "Report @{name}",
"status.sensitive_warning": "Sensitive content",
"status.sensitive_warning.subtitle": "This content may not be suitable for all audiences.",
@@ -1511,10 +1516,20 @@
"tabs_bar.search": "Search",
"tabs_bar.settings": "Settings",
"textarea.counter.label": "{count} characters remaining",
"theme_editor.Reset": "Reset",
"theme_editor.colors.accent": "Accent",
"theme_editor.colors.accent_blue": "Accent Blue",
"theme_editor.colors.danger": "Danger",
"theme_editor.colors.gradient_end": "Gradient End",
"theme_editor.colors.gradient_start": "Gradient Start",
"theme_editor.colors.gray": "Gray",
"theme_editor.colors.greentext": "Greentext",
"theme_editor.colors.primary": "Primary",
"theme_editor.colors.secondary": "Secondary",
"theme_editor.colors.success": "Success",
"theme_editor.export": "Export theme",
"theme_editor.import": "Import theme",
"theme_editor.import_success": "Theme was successfully imported!",
"theme_editor.reset": "Reset",
"theme_editor.restore": "Restore default theme",
"theme_editor.save": "Save theme",
"theme_editor.saved": "Theme updated!",
@@ -1534,7 +1549,7 @@
"toast.view": "View",
"trends.count_by_accounts": "{count} {rawCount, plural, one {person} other {people}} talking",
"trends.title": "Trends",
"trendsPanel.viewAll": "View all",
"trends_panel.view_all": "View all",
"unauthorized_modal.text": "You need to be logged in to do that.",
"unauthorized_modal.title": "Sign up for {site_title}",
"upload_button.label": "Add media attachment",

View File

@@ -1,4 +1,5 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { useHistory } from 'react-router-dom';
import { Column, Layout, Tabs } from 'soapbox/components/ui';
@@ -46,12 +47,12 @@ const EventPage: React.FC<IEventPage> = ({ params, children }) => {
const tabs = status ? [
{
text: 'Information',
text: <FormattedMessage id='event.information' defaultMessage='Information' />,
to: `/@${status.getIn(['account', 'acct'])}/events/${status.id}`,
name: 'info',
},
{
text: 'Discussion',
text: <FormattedMessage id='event.discussion' defaultMessage='Discussion' />,
to: `/@${status.getIn(['account', 'acct'])}/events/${status.id}/discussion`,
name: 'discussion',
},