From cc6c4132a6f58a0eddf4a600c5569fe9c353f626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Mon, 20 Oct 2025 22:22:39 +0200 Subject: [PATCH] pl-fe: i18n cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- packages/pl-fe/src/actions/moderation.tsx | 7 +- packages/pl-fe/src/components/account.tsx | 4 +- .../pl-fe/src/components/birthday-input.tsx | 6 +- .../src/components/dropdown-navigation.tsx | 69 ++++++------------- packages/pl-fe/src/components/polls/poll.tsx | 9 +-- .../pl-fe/src/components/search-input.tsx | 4 +- .../chats/components/chat-list-item.tsx | 2 - .../features/ui/components/link-footer.tsx | 1 - packages/pl-fe/src/locales/en.json | 1 + 9 files changed, 35 insertions(+), 68 deletions(-) diff --git a/packages/pl-fe/src/actions/moderation.tsx b/packages/pl-fe/src/actions/moderation.tsx index 2b2342eeb..24984d159 100644 --- a/packages/pl-fe/src/actions/moderation.tsx +++ b/packages/pl-fe/src/actions/moderation.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { defineMessages, IntlShape } from 'react-intl'; +import { defineMessages, FormattedMessage, IntlShape } from 'react-intl'; import { fetchAccountByUsername } from 'pl-fe/actions/accounts'; import { deactivateUser, deleteUser, deleteStatus, toggleStatusSensitivity } from 'pl-fe/actions/admin'; @@ -15,7 +15,6 @@ import type { AppDispatch, RootState } from 'pl-fe/store'; const messages = defineMessages({ deactivateUserHeading: { id: 'confirmations.admin.deactivate_user.heading', defaultMessage: 'Deactivate @{acct}' }, - deactivateUserPrompt: { id: 'confirmations.admin.deactivate_user.message', defaultMessage: 'You are about to deactivate @{acct}. Deactivating a user is a reversible action.' }, deactivateUserConfirm: { id: 'confirmations.admin.deactivate_user.confirm', defaultMessage: 'Deactivate @{name}' }, userDeactivated: { id: 'admin.users.user_deactivated_message', defaultMessage: '@{acct} was deactivated' }, deleteUserHeading: { id: 'confirmations.admin.delete_user.heading', defaultMessage: 'Delete @{acct}' }, @@ -50,7 +49,7 @@ const deactivateUserModal = (intl: IntlShape, accountId: string, afterConfirm = - {intl.formatMessage(messages.deactivateUserPrompt, { acct })} + ); @@ -84,7 +83,7 @@ const deleteUserModal = (intl: IntlShape, accountId: string, afterConfirm = () = - {intl.formatMessage(messages.deleteUserPrompt, { acct })} + ); diff --git a/packages/pl-fe/src/components/account.tsx b/packages/pl-fe/src/components/account.tsx index c8e707905..2d198e5b6 100644 --- a/packages/pl-fe/src/components/account.tsx +++ b/packages/pl-fe/src/components/account.tsx @@ -250,7 +250,7 @@ const Account = ({ {account.verified && } - {account.bot && } + {account.bot && } />} @@ -329,7 +329,7 @@ const Account = ({ {account.verified && } - {account.bot && } + {account.bot && } />} diff --git a/packages/pl-fe/src/components/birthday-input.tsx b/packages/pl-fe/src/components/birthday-input.tsx index e57976ec7..7fa6fbd19 100644 --- a/packages/pl-fe/src/components/birthday-input.tsx +++ b/packages/pl-fe/src/components/birthday-input.tsx @@ -1,5 +1,5 @@ import React, { useMemo } from 'react'; -import { defineMessages, useIntl } from 'react-intl'; +import { defineMessages, FormattedDate, useIntl } from 'react-intl'; import IconButton from 'pl-fe/components/icon-button'; import { DatePicker } from 'pl-fe/features/ui/util/async-components'; @@ -76,7 +76,7 @@ const BirthdayInput: React.FC = ({ value, onChange, required }) aria-label={intl.formatMessage(messages.previousMonth)} title={intl.formatMessage(messages.previousMonth)} /> - {intl.formatDate(date, { month: 'long' })} + = ({ value, onChange, required }) aria-label={intl.formatMessage(messages.previousYear)} title={intl.formatMessage(messages.previousYear)} /> - {intl.formatDate(date, { year: 'numeric' })} + = React.memo(({ }); const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { - const intl = useIntl(); const dispatch = useAppDispatch(); const { isSidebarOpen, closeSidebar } = useUiStore(); @@ -223,7 +198,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} /> @@ -231,7 +206,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} /> )} @@ -240,7 +215,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} /> )} @@ -249,7 +224,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} /> )} @@ -258,7 +233,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} /> )} @@ -267,7 +242,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} /> )} @@ -276,7 +251,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} /> )} @@ -285,7 +260,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} /> )} @@ -294,7 +269,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} /> )} @@ -303,7 +278,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} /> )} @@ -312,7 +287,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} /> )} @@ -321,7 +296,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} /> )} @@ -369,7 +344,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} /> @@ -377,7 +352,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} /> )} @@ -386,7 +361,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} // count={dashboardCount} WIP /> @@ -397,7 +372,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={onClickLogOut} /> @@ -406,7 +381,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} /> @@ -433,7 +408,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { - {intl.formatMessage(messages.addAccount)} + )} @@ -483,7 +458,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} /> @@ -491,7 +466,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} /> )} @@ -501,7 +476,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => { } onClick={closeSidebar} /> diff --git a/packages/pl-fe/src/components/polls/poll.tsx b/packages/pl-fe/src/components/polls/poll.tsx index 3abf16694..983038c6d 100644 --- a/packages/pl-fe/src/components/polls/poll.tsx +++ b/packages/pl-fe/src/components/polls/poll.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { defineMessages, useIntl } from 'react-intl'; +import { FormattedMessage } from 'react-intl'; import { vote } from 'pl-fe/actions/polls'; import Stack from 'pl-fe/components/ui/stack'; @@ -23,14 +23,9 @@ interface IPoll { truncate?: boolean; } -const messages = defineMessages({ - multiple: { id: 'poll.choose_multiple', defaultMessage: 'Choose as many as you\'d like.' }, -}); - const Poll: React.FC = ({ id, status, language, truncate }): JSX.Element | null => { const { openModal } = useModalsStore(); const dispatch = useAppDispatch(); - const intl = useIntl(); const isLoggedIn = useAppSelector((state) => state.me); const poll = useAppSelector((state) => state.polls[id]); @@ -79,7 +74,7 @@ const Poll: React.FC = ({ id, status, language, truncate }): JSX.Element
e.stopPropagation()}> {!showResults && poll.multiple && ( - {intl.formatMessage(messages.multiple)} + )} diff --git a/packages/pl-fe/src/components/search-input.tsx b/packages/pl-fe/src/components/search-input.tsx index 81188991c..26fbb0a8a 100644 --- a/packages/pl-fe/src/components/search-input.tsx +++ b/packages/pl-fe/src/components/search-input.tsx @@ -1,6 +1,6 @@ import clsx from 'clsx'; import React, { useState } from 'react'; -import { defineMessages, useIntl } from 'react-intl'; +import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import { useHistory } from 'react-router-dom'; import AutosuggestAccountInput from 'pl-fe/components/autosuggest-account-input'; @@ -74,7 +74,7 @@ const SearchInput = React.memo(() => { return (
- +