feat: add lingui/no-unlocalized-strings ESLint rule and fix translations (#16610)
## Summary
This PR adds the `lingui/no-unlocalized-strings` ESLint rule to detect
untranslated strings and fixes translation issues across multiple
components.
## Changes
### ESLint Configuration (`eslint.config.react.mjs`)
- Added comprehensive `ignore` patterns for non-translatable strings
(CSS values, HTML attributes, technical identifiers)
- Added `ignoreNames` for props that don't need translation (className,
data-*, aria-*, etc.)
- Added `ignoreFunctions` for console methods, URL APIs, and other
non-user-facing functions
- Disabled rule for debug files, storybook, and test files
### Components Fixed (~19 files)
- Object record components (field inputs, pickers, merge dialogs)
- Settings components (accounts, admin panel)
- Serverless function components
- Record table and title cell components
## Status
🚧 **Work in Progress** - ~124 files remaining to fix
This PR is being submitted as draft to allow progressive fixing of
remaining translation issues.
## Testing
- Run `npx eslint "src/**/*.tsx"` in `packages/twenty-front` to check
remaining issues
This commit is contained in:
+8
-2
@@ -1,3 +1,5 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { useInputFocusWithoutScrollOnMount } from '@/ui/input/hooks/useInputFocusWithoutScrollOnMount';
|
||||
import styled from '@emotion/styled';
|
||||
import { forwardRef, type InputHTMLAttributes } from 'react';
|
||||
@@ -32,17 +34,21 @@ const StyledInput = styled.input`
|
||||
}
|
||||
`;
|
||||
|
||||
const defaultSearchPlaceholder = msg`Search`;
|
||||
|
||||
export const DropdownMenuSearchInput = forwardRef<
|
||||
HTMLInputElement,
|
||||
InputHTMLAttributes<HTMLInputElement>
|
||||
>(({ value, onChange, placeholder = 'Search', type }, forwardedRef) => {
|
||||
>(({ value, onChange, placeholder, type }, forwardedRef) => {
|
||||
const { i18n } = useLingui();
|
||||
const { inputRef } = useInputFocusWithoutScrollOnMount();
|
||||
const ref = forwardedRef ?? inputRef;
|
||||
const translatedPlaceholder = placeholder ?? i18n._(defaultSearchPlaceholder);
|
||||
return (
|
||||
<StyledDropdownMenuSearchInputContainer>
|
||||
<StyledInput
|
||||
autoComplete="off"
|
||||
{...{ onChange, placeholder, type, value }}
|
||||
{...{ onChange, placeholder: translatedPlaceholder, type, value }}
|
||||
ref={ref}
|
||||
/>
|
||||
</StyledDropdownMenuSearchInputContainer>
|
||||
|
||||
+2
-1
@@ -23,6 +23,7 @@ import {
|
||||
import { Button } from 'twenty-ui/input';
|
||||
import { MenuItem } from 'twenty-ui/navigation';
|
||||
import { ComponentDecorator } from 'twenty-ui/testing';
|
||||
import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
|
||||
import { Dropdown } from '../Dropdown';
|
||||
import { DropdownMenuHeader } from '../DropdownMenuHeader/DropdownMenuHeader';
|
||||
import { DropdownMenuInput } from '../DropdownMenuInput';
|
||||
@@ -34,7 +35,7 @@ import { StyledDropdownMenuSubheader } from '../StyledDropdownMenuSubheader';
|
||||
const meta: Meta<typeof Dropdown> = {
|
||||
title: 'UI/Layout/Dropdown/Dropdown',
|
||||
component: Dropdown,
|
||||
decorators: [ComponentDecorator, (Story) => <Story />],
|
||||
decorators: [I18nFrontDecorator, ComponentDecorator, (Story) => <Story />],
|
||||
args: {
|
||||
clickableComponent: <Button title="Open Dropdown" />,
|
||||
dropdownOffset: { x: 0, y: 8 },
|
||||
|
||||
@@ -6,6 +6,7 @@ import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';
|
||||
|
||||
import { Modal, type ModalVariants } from '@/ui/layout/modal/components/Modal';
|
||||
import { useModal } from '@/ui/layout/modal/hooks/useModal';
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { H1Title, H1TitleFontColor } from 'twenty-ui/display';
|
||||
import { Button, type ButtonAccent } from 'twenty-ui/input';
|
||||
@@ -57,6 +58,8 @@ export const StyledConfirmationButton = styled(StyledCenteredButton)`
|
||||
}
|
||||
`;
|
||||
|
||||
const defaultConfirmButtonText = msg`Confirm`;
|
||||
|
||||
export const ConfirmationModal = ({
|
||||
modalId,
|
||||
title,
|
||||
@@ -64,14 +67,16 @@ export const ConfirmationModal = ({
|
||||
subtitle,
|
||||
onConfirmClick,
|
||||
onClose,
|
||||
confirmButtonText = 'Confirm',
|
||||
confirmButtonText,
|
||||
confirmationValue,
|
||||
confirmationPlaceholder,
|
||||
confirmButtonAccent = 'danger',
|
||||
AdditionalButtons,
|
||||
modalVariant = 'primary',
|
||||
}: ConfirmationModalProps) => {
|
||||
const { t } = useLingui();
|
||||
const { i18n, t } = useLingui();
|
||||
const translatedConfirmButtonText =
|
||||
confirmButtonText ?? i18n._(defaultConfirmButtonText);
|
||||
const [inputConfirmationValue, setInputConfirmationValue] =
|
||||
useState<string>('');
|
||||
const [isValidValue, setIsValidValue] = useState(!confirmationValue);
|
||||
@@ -156,7 +161,7 @@ export const ConfirmationModal = ({
|
||||
onClick={handleConfirmClick}
|
||||
variant="secondary"
|
||||
accent={confirmButtonAccent}
|
||||
title={confirmButtonText}
|
||||
title={translatedConfirmButtonText}
|
||||
disabled={!isValidValue || loading}
|
||||
fullWidth
|
||||
dataTestId="confirmation-modal-confirm-button"
|
||||
|
||||
Reference in New Issue
Block a user