From 9585b3a87087b39a005ebb198b0b5f55db72d25b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Mon, 25 Mar 2024 12:40:07 +0100 Subject: [PATCH] Add missing strings to translation, enable formatjs ESLint rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .eslintrc.json | 10 +- package.json | 1 + src/components/status-action-bar.tsx | 2 +- src/components/ui/modal/modal.tsx | 4 +- src/components/ui/toast/toast.tsx | 2 +- .../auth-login/components/captcha.tsx | 3 +- .../chats/components/chat-message-list.tsx | 4 +- .../chats/components/chat-message.tsx | 2 +- src/features/directory/index.tsx | 18 ++- src/features/follow-recommendations/index.tsx | 2 +- .../groups/components/group-link-preview.tsx | 3 +- .../status/components/detailed-status.tsx | 4 +- src/features/theme-editor/index.tsx | 32 +++-- .../components/modals/landing-page-modal.tsx | 2 +- .../modals/report-modal/report-modal.tsx | 4 +- .../report-modal/steps/other-actions-step.tsx | 10 +- src/features/ui/components/trends-panel.tsx | 2 +- src/locales/en.json | 47 ++++--- src/pages/event-page.tsx | 5 +- yarn.lock | 125 +++++++++++++++++- 20 files changed, 220 insertions(+), 62 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 209da449d..84f6bb0b5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -22,7 +22,8 @@ "import", "promise", "react-hooks", - "@typescript-eslint" + "@typescript-eslint", + "formatjs" ], "parserOptions": { "sourceType": "module", @@ -311,7 +312,12 @@ "config": "tailwind.config.ts" } ], - "tailwindcss/migration-from-tailwind-2": "error" + "tailwindcss/migration-from-tailwind-2": "error", + + + "formatjs/enforce-default-message": "error", + "formatjs/enforce-id": "error", + "formatjs/no-literal-string-in-jsx": "warn" }, "overrides": [ { diff --git a/package.json b/package.json index 5fdca8015..bde744cfc 100644 --- a/package.json +++ b/package.json @@ -119,6 +119,7 @@ "emoji-datasource": "14.0.0", "emoji-mart": "^5.5.2", "escape-html": "^1.0.3", + "eslint-plugin-formatjs": "^4.12.2", "exifr": "^7.1.3", "graphemesplit": "^2.4.4", "html-react-parser": "^5.0.0", diff --git a/src/components/status-action-bar.tsx b/src/components/status-action-bar.tsx index 604358f19..0d0de6a1f 100644 --- a/src/components/status-action-bar.tsx +++ b/src/components/status-action-bar.tsx @@ -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}' }, diff --git a/src/components/ui/modal/modal.tsx b/src/components/ui/modal/modal.tsx index 3c25d3678..5d17d6f67 100644 --- a/src/components/ui/modal/modal.tsx +++ b/src/components/ui/modal/modal.tsx @@ -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(({ theme='tertiary' onClick={cancelAction} > - {cancelText || 'Cancel'} + {cancelText || } )} diff --git a/src/components/ui/toast/toast.tsx b/src/components/ui/toast/toast.tsx index ed89fe46b..af6509b9c 100644 --- a/src/components/ui/toast/toast.tsx +++ b/src/components/ui/toast/toast.tsx @@ -142,7 +142,7 @@ const Toast = (props: IToast) => { onClick={dismissToast} data-testid='toast-dismiss' > - Close + diff --git a/src/features/auth-login/components/captcha.tsx b/src/features/auth-login/components/captcha.tsx index e02bf7499..47ac55066 100644 --- a/src/features/auth-login/components/captcha.tsx +++ b/src/features/auth-login/components/captcha.tsx @@ -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 = ({ captcha, onChange, return (
- captcha + {intl.formatMessage(messages.captcha)}
{
- Display filter + + +
- Display filter + + +
@@ -65,9 +69,13 @@ const Directory = () => { {features.federating && (
- Fediverse filter + + +
- Fediverse filter + + +
diff --git a/src/features/follow-recommendations/index.tsx b/src/features/follow-recommendations/index.tsx index 166396c91..703e23101 100644 --- a/src/features/follow-recommendations/index.tsx +++ b/src/features/follow-recommendations/index.tsx @@ -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 = () => { diff --git a/src/features/groups/components/group-link-preview.tsx b/src/features/groups/components/group-link-preview.tsx index 87fa9d793..6a7645bc9 100644 --- a/src/features/groups/components/group-link-preview.tsx +++ b/src/features/groups/components/group-link-preview.tsx @@ -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 = ({ card }) => { } /> diff --git a/src/features/status/components/detailed-status.tsx b/src/features/status/components/detailed-status.tsx index 970a4683a..73948580f 100644 --- a/src/features/status/components/detailed-status.tsx +++ b/src/features/status/components/detailed-status.tsx @@ -100,7 +100,7 @@ const DetailedStatus: React.FC = ({ if (actualStatus.pleroma.get('quote_visible', true) === false) { quote = (
-

+

); } else { @@ -190,7 +190,7 @@ const DetailedStatus: React.FC = ({ tabIndex={0} > - +
diff --git a/src/features/theme-editor/index.tsx b/src/features/theme-editor/index.tsx index d7ea6e7cd..e6c624b35 100644 --- a/src/features/theme-editor/index.tsx +++ b/src/features/theme-editor/index.tsx @@ -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 = () => {
= () => { @@ -210,7 +220,7 @@ const ThemeEditor: React.FC = () => { }]} />