A local-first personal finance app
add some basic linting rules for translation consistency (#5212)
Matt Fiddaman2d95fe6d0312
diff --git a/bin/release-note-generator.ts b/bin/release-note-generator.tsindex de1346f9b1..4a0395241e 100644--- a/bin/release-note-generator.ts+++ b/bin/release-note-generator.ts@@ -6,7 +6,7 @@ import prompts from 'prompts';async function run() {const username = await execAsync(- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typography"gh api user --jq '.login'",'To avoid having to enter your username, consider installing the official GitHub CLI (https://github.com/cli/cli) and logging in with `gh auth login`.',);diff --git a/eslint.config.mjs b/eslint.config.mjsindex 0c9aa15e51..eea22bda24 100644--- a/eslint.config.mjs+++ b/eslint.config.mjs@@ -1,29 +1,15 @@-import path from 'node:path';-import { fileURLToPath } from 'node:url';-import globals from 'globals';import pluginImport from 'eslint-plugin-import';import pluginJSXA11y from 'eslint-plugin-jsx-a11y';import pluginReact from 'eslint-plugin-react';import pluginReactHooks from 'eslint-plugin-react-hooks';-import pluginRulesDir from 'eslint-plugin-rulesdir';import pluginTypescript from 'typescript-eslint';import pluginTypescriptPaths from 'eslint-plugin-typescript-paths';+import pluginActual from './packages/eslint-plugin-actual/lib/index.js';import tsParser from '@typescript-eslint/parser';-const __filename = fileURLToPath(import.meta.url);-const __dirname = path.dirname(__filename);--pluginRulesDir.RULES_DIR = path.join(- __dirname,- 'packages',- 'eslint-plugin-actual',- 'lib',- 'rules',-);-const confusingBrowserGlobals = [// https://github.com/facebook/create-react-app/tree/main/packages/confusing-browser-globals'addEventListener',@@ -167,11 +153,15 @@ export default pluginTypescript.config(pluginImport.flatConfigs.recommended,{plugins: {+ actual: pluginActual,'react-hooks': pluginReactHooks,'jsx-a11y': pluginJSXA11y,- rulesdir: pluginRulesDir,'typescript-paths': pluginTypescriptPaths,},+ rules: {+ 'actual/no-untranslated-strings': 'error',+ 'actual/prefer-trans-over-t': 'error',+ },},{files: ['**/*.{js,ts,jsx,tsx}'],@@ -458,8 +448,8 @@ export default pluginTypescript.config(},],- 'rulesdir/typography': 'warn',- 'rulesdir/prefer-if-statement': 'warn',+ 'actual/typography': 'warn',+ 'actual/prefer-if-statement': 'warn',// Note: base rule explicitly disabled in favor of the TS one'no-unused-vars': 'off',@@ -778,7 +768,8 @@ export default pluginTypescript.config(],rules: {- 'rulesdir/typography': 'off',+ 'actual/typography': 'off',+ 'actual/no-untranslated-strings': 'off',},},{@@ -797,7 +788,7 @@ export default pluginTypescript.config(// TODO: fix the issues in these filesrules: {'import/extensions': 'off',- 'rulesdir/typography': 'off',+ 'actual/typography': 'off',},},{@@ -805,8 +796,6 @@ export default pluginTypescript.config(rules: {'import/no-anonymous-default-export': 'off','import/no-default-export': 'off',- // can be re-enabled after https://github.com/actualbudget/actual/pull/4253- '@typescript-eslint/no-unused-vars': 'off',},},);diff --git a/package.json b/package.jsonindex 83123ec320..b628494686 100644--- a/package.json+++ b/package.json@@ -65,7 +65,6 @@"eslint-plugin-jsx-a11y": "^6.10.2","eslint-plugin-react": "^7.37.5","eslint-plugin-react-hooks": "^5.2.0",- "eslint-plugin-rulesdir": "^0.2.2","eslint-plugin-typescript-paths": "^0.0.33","globals": "^15.15.0","html-to-image": "^1.11.13",diff --git a/packages/component-library/src/Toggle.tsx b/packages/component-library/src/Toggle.tsxindex ae9d1cb63e..ee055edf8b 100644--- a/packages/component-library/src/Toggle.tsx+++ b/packages/component-library/src/Toggle.tsx@@ -62,7 +62,7 @@ export const Toggle = ({data-on={isOn}className={css({- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typographycontent: '" "',position: 'absolute',top: '2px',diff --git a/packages/component-library/src/styles.ts b/packages/component-library/src/styles.tsindex ea21ddd0a9..0e5d0eeead 100644--- a/packages/component-library/src/styles.ts+++ b/packages/component-library/src/styles.ts@@ -91,7 +91,7 @@ export const styles: Record<string, any> = {},shadowLarge,tnum: {- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typographyfontFeatureSettings: '"tnum"',},notFixed: { fontFeatureSettings: '' },diff --git a/packages/desktop-client/e2e/fixtures.ts b/packages/desktop-client/e2e/fixtures.tsindex 68efa9104b..0c9dc10b5a 100644--- a/packages/desktop-client/e2e/fixtures.ts+++ b/packages/desktop-client/e2e/fixtures.ts@@ -14,7 +14,7 @@ export const expect = baseExpect.extend({}const config = {- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typographymask: [locator.locator('[data-vrt-mask="true"]')],maxDiffPixels: 5,};diff --git a/packages/desktop-client/src/auth/ProtectedRoute.tsx b/packages/desktop-client/src/auth/ProtectedRoute.tsxindex 911d88ff12..9b65272899 100644--- a/packages/desktop-client/src/auth/ProtectedRoute.tsx+++ b/packages/desktop-client/src/auth/ProtectedRoute.tsx@@ -1,4 +1,5 @@import { useEffect, useState, type ReactElement } from 'react';+import { Trans } from 'react-i18next';import { View } from '@actual-app/components/view';@@ -60,7 +61,9 @@ export const ProtectedRoute = ({margin: '50px',}}>- <h3>You don't have permission to view this page</h3>+ <h3>+ <Trans>You don’t have permission to view this page</Trans>+ </h3></View>);};diff --git a/packages/desktop-client/src/components/CommandBar.tsx b/packages/desktop-client/src/components/CommandBar.tsxindex 02291e06c5..83d8627077 100644--- a/packages/desktop-client/src/components/CommandBar.tsx+++ b/packages/desktop-client/src/components/CommandBar.tsx@@ -245,7 +245,7 @@ export function CommandBar() {'var(--color-menuItemBackgroundHover)',color: 'var(--color-menuItemTextHover)',},- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typography"&[data-selected='true']": {backgroundColor: 'var(--color-menuItemBackgroundHover)',color: 'var(--color-menuItemTextHover)',diff --git a/packages/desktop-client/src/components/budget/envelope/EnvelopeBudgetComponents.tsx b/packages/desktop-client/src/components/budget/envelope/EnvelopeBudgetComponents.tsxindex 6d26b8946a..997f055b76 100644--- a/packages/desktop-client/src/components/budget/envelope/EnvelopeBudgetComponents.tsx+++ b/packages/desktop-client/src/components/budget/envelope/EnvelopeBudgetComponents.tsx@@ -114,13 +114,17 @@ export const BudgetTotalsMonth = memo(function BudgetTotalsMonth() {</EnvelopeCellValue></View><View style={headerLabelStyle}>- <Text style={{ color: theme.tableHeaderText }}>Spent</Text>+ <Text style={{ color: theme.tableHeaderText }}>+ <Trans>Spent</Trans>+ </Text><EnvelopeCellValue binding={envelopeBudget.totalSpent} type="financial">{props => <CellValueText {...props} style={cellStyle} />}</EnvelopeCellValue></View><View style={headerLabelStyle}>- <Text style={{ color: theme.tableHeaderText }}>Balance</Text>+ <Text style={{ color: theme.tableHeaderText }}>+ <Trans>Balance</Trans>+ </Text><EnvelopeCellValuebinding={envelopeBudget.totalBalance}type="financial"diff --git a/packages/desktop-client/src/components/forms.tsx b/packages/desktop-client/src/components/forms.tsxindex 19d7fea908..a739573584 100644--- a/packages/desktop-client/src/components/forms.tsx+++ b/packages/desktop-client/src/components/forms.tsx@@ -96,11 +96,11 @@ export const Checkbox = (props: CheckboxProps) => {display: 'block',background:theme.checkboxBackgroundSelected +- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typography' url(\'data:image/svg+xml; utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="white" d="M0 11l2-2 5 5L18 3l2 2L7 18z"/></svg>\') 9px 9px',width: 9,height: 9,- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typographycontent: '" "',},},@@ -124,7 +124,7 @@ export const Checkbox = (props: CheckboxProps) => {right: -5,border: '2px solid ' + theme.checkboxBorderSelected,borderRadius: 6,- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typographycontent: '" "',},},diff --git a/packages/desktop-client/src/components/mobile/MobileBackButton.tsx b/packages/desktop-client/src/components/mobile/MobileBackButton.tsxindex 8d72f86ee0..63b36e1034 100644--- a/packages/desktop-client/src/components/mobile/MobileBackButton.tsx+++ b/packages/desktop-client/src/components/mobile/MobileBackButton.tsx@@ -1,5 +1,5 @@import React, { type ComponentPropsWithoutRef } from 'react';-import { useTranslation } from 'react-i18next';+import { Trans } from 'react-i18next';import { Button } from '@actual-app/components/button';import { SvgCheveronLeft } from '@actual-app/components/icons/v1';@@ -15,7 +15,6 @@ export function MobileBackButton({style,...props}: MobileBackButtonProps) {- const { t } = useTranslation();const navigate = useNavigate();return (<Button@@ -38,7 +37,7 @@ export function MobileBackButton({marginRight: 5,}}>- {t('Back')}+ <Trans>Back</Trans></Text></Button>);diff --git a/packages/desktop-client/src/components/modals/AccountMenuModal.tsx b/packages/desktop-client/src/components/modals/AccountMenuModal.tsxindex 5859540b00..ffcc783097 100644--- a/packages/desktop-client/src/components/modals/AccountMenuModal.tsx+++ b/packages/desktop-client/src/components/modals/AccountMenuModal.tsx@@ -5,7 +5,7 @@ import {useRef,useState,} from 'react';-import { useTranslation } from 'react-i18next';+import { Trans, useTranslation } from 'react-i18next';import { Button } from '@actual-app/components/button';import {@@ -190,7 +190,7 @@ export function AccountMenuModal({height={20}style={{ paddingRight: 5 }}/>- {t('Edit notes')}+ <Trans>Edit notes</Trans></Button></View></View>diff --git a/packages/desktop-client/src/components/modals/BudgetFileSelectionModal.tsx b/packages/desktop-client/src/components/modals/BudgetFileSelectionModal.tsxindex f172769eb9..44e13913a0 100644--- a/packages/desktop-client/src/components/modals/BudgetFileSelectionModal.tsx+++ b/packages/desktop-client/src/components/modals/BudgetFileSelectionModal.tsx@@ -1,5 +1,5 @@import React from 'react';-import { useTranslation } from 'react-i18next';+import { Trans, useTranslation } from 'react-i18next';import { Text } from '@actual-app/components/text';import { View } from '@actual-app/components/view';@@ -36,7 +36,7 @@ export function BudgetFileSelectionModal() {}}><Text style={{ fontSize: 17, fontWeight: 400 }}>- {t('Switching from:')}+ <Trans>Switching from:</Trans></Text><Text style={{ fontSize: 17, fontWeight: 700 }}>{currentFile?.name}diff --git a/packages/desktop-client/src/components/modals/CategoryGroupMenuModal.tsx b/packages/desktop-client/src/components/modals/CategoryGroupMenuModal.tsxindex a67a6c123a..bb3858aef0 100644--- a/packages/desktop-client/src/components/modals/CategoryGroupMenuModal.tsx+++ b/packages/desktop-client/src/components/modals/CategoryGroupMenuModal.tsx@@ -5,7 +5,7 @@ import React, {useState,type CSSProperties,} from 'react';-import { useTranslation } from 'react-i18next';+import { Trans, useTranslation } from 'react-i18next';import { Button } from '@actual-app/components/button';import {@@ -49,7 +49,6 @@ export function CategoryGroupMenuModal({onToggleVisibility,onClose,}: CategoryGroupMenuModalProps) {- const { t } = useTranslation();const { grouped: categoryGroups } = useCategories();const group = categoryGroups.find(g => g.id === groupId);const notes = useNotes(group.id);@@ -156,7 +155,7 @@ export function CategoryGroupMenuModal({><Button style={buttonStyle} onPress={_onAddCategory}><SvgAdd width={17} height={17} style={{ paddingRight: 5 }} />- {t('Add category')}+ <Trans>Add category</Trans></Button><Button style={buttonStyle} onPress={_onEditNotes}><SvgNotesPaper@@ -164,7 +163,7 @@ export function CategoryGroupMenuModal({height={20}style={{ paddingRight: 5 }}/>- {t('Edit notes')}+ <Trans>Edit notes</Trans></Button></View></View>diff --git a/packages/desktop-client/src/components/modals/CategoryMenuModal.tsx b/packages/desktop-client/src/components/modals/CategoryMenuModal.tsxindex 11ef6ecb55..a999110ed0 100644--- a/packages/desktop-client/src/components/modals/CategoryMenuModal.tsx+++ b/packages/desktop-client/src/components/modals/CategoryMenuModal.tsx@@ -1,6 +1,6 @@// @ts-strict-ignoreimport React, { useRef, useState, type CSSProperties } from 'react';-import { useTranslation } from 'react-i18next';+import { Trans, useTranslation } from 'react-i18next';import { Button } from '@actual-app/components/button';import {@@ -148,7 +148,7 @@ export function CategoryMenuModal({height={20}style={{ paddingRight: 5 }}/>- {t('Edit notes')}+ <Trans>Edit notes</Trans></Button></View></View>diff --git a/packages/desktop-client/src/components/modals/ConfirmCategoryDeleteModal.tsx b/packages/desktop-client/src/components/modals/ConfirmCategoryDeleteModal.tsxindex 19032d0c9b..304b6f90d0 100644--- a/packages/desktop-client/src/components/modals/ConfirmCategoryDeleteModal.tsx+++ b/packages/desktop-client/src/components/modals/ConfirmCategoryDeleteModal.tsx@@ -1,6 +1,6 @@// @ts-strict-ignoreimport React, { useState } from 'react';-import { useTranslation } from 'react-i18next'; // Import useTranslation+import { Trans, useTranslation } from 'react-i18next'; // Import useTranslationimport { Block } from '@actual-app/components/block';import { Button } from '@actual-app/components/button';@@ -8,6 +8,8 @@ import { Text } from '@actual-app/components/text';import { theme } from '@actual-app/components/theme';import { View } from '@actual-app/components/view';+import { type TransObjectLiteral } from 'loot-core/types/util';+import { CategoryAutocomplete } from '@desktop-client/components/autocomplete/CategoryAutocomplete';import {Modal,@@ -73,23 +75,53 @@ export function ConfirmCategoryDeleteModal({<View style={{ lineHeight: 1.5 }}>{group ? (<Block>- Categories in the group <strong>{group.name}</strong> are used- by existing transactions- {!isIncome &&- ' or it has a positive leftover balance currently'}- . <strong>Are you sure you want to delete it?</strong> If so,- you must select another category to transfer existing- transactions and balance to.+ {!isIncome ? (+ <Trans>+ Categories in the group{' '}+ <strong>+ {{ group: group.name } as TransObjectLiteral}+ </strong>{' '}+ are used by existing transactions.+ </Trans>+ ) : (+ <Trans>+ Categories in the group{' '}+ <strong>+ {{ group: group.name } as TransObjectLiteral}+ </strong>{' '}+ are used by existing transactions or it has a positive+ leftover balance currently.+ </Trans>+ )}+ <Trans>+ <strong>Are you sure you want to delete it?</strong> If so,+ you must select another category to transfer existing+ transactions and balance to.+ </Trans></Block>) : (<Block>- <strong>{category.name}</strong> is used by existing- transactions- {!isIncome &&- ' or it has a positive leftover balance currently'}- . <strong>Are you sure you want to delete it?</strong> If so,- you must select another category to transfer existing- transactions and balance to.+ {!isIncome ? (+ <Trans>+ <strong>+ {{ category: category.name } as TransObjectLiteral}+ </strong>{' '}+ is used by existing transactions.+ </Trans>+ ) : (+ <Trans>+ <strong>+ {{ category: category.name } as TransObjectLiteral}+ </strong>{' '}+ is used by existing transactions or it has a positive+ leftover balance currently.+ </Trans>+ )}+ <Trans>+ <strong>Are you sure you want to delete it?</strong> If so,+ you must select another category to transfer existing+ transactions and balance to.+ </Trans></Block>)}@@ -103,7 +135,9 @@ export function ConfirmCategoryDeleteModal({alignItems: 'center',}}>- <Text>{t('Transfer to:')}</Text>+ <Text>+ <Trans>Transfer to:</Trans>+ </Text><View style={{ flex: 1, marginLeft: 10, marginRight: 30 }}><CategoryAutocomplete@@ -142,7 +176,7 @@ export function ConfirmCategoryDeleteModal({}}}>- {t('Delete')}+ <Trans>Delete</Trans></Button></View></View>diff --git a/packages/desktop-client/src/components/modals/ConfirmTransactionDeleteModal.tsx b/packages/desktop-client/src/components/modals/ConfirmTransactionDeleteModal.tsxindex 5d606a5c62..15b55e2ebe 100644--- a/packages/desktop-client/src/components/modals/ConfirmTransactionDeleteModal.tsx+++ b/packages/desktop-client/src/components/modals/ConfirmTransactionDeleteModal.tsx@@ -1,5 +1,5 @@import React from 'react';-import { useTranslation } from 'react-i18next';+import { Trans, useTranslation } from 'react-i18next';import { Button } from '@actual-app/components/button';import { useResponsive } from '@actual-app/components/hooks/useResponsive';@@ -55,7 +55,7 @@ export function ConfirmTransactionDeleteModal({}}onPress={close}>- {t('Cancel')}+ <Trans>Cancel</Trans></Button><InitialFocus><Button@@ -66,7 +66,7 @@ export function ConfirmTransactionDeleteModal({close();}}>- {t('Delete')}+ <Trans>Delete</Trans></Button></InitialFocus></View>diff --git a/packages/desktop-client/src/components/modals/ConfirmUnlinkAccountModal.tsx b/packages/desktop-client/src/components/modals/ConfirmUnlinkAccountModal.tsxindex d99a1ae7b8..a4c81d13de 100644--- a/packages/desktop-client/src/components/modals/ConfirmUnlinkAccountModal.tsx+++ b/packages/desktop-client/src/components/modals/ConfirmUnlinkAccountModal.tsx@@ -60,7 +60,7 @@ export function ConfirmUnlinkAccountModal({}}><Button style={{ marginRight: 10 }} onPress={close}>- {t('Cancel')}+ <Trans>Cancel</Trans></Button><InitialFocus><Button@@ -70,7 +70,7 @@ export function ConfirmUnlinkAccountModal({close();}}>- {t('Unlink')}+ <Trans>Unlink</Trans></Button></InitialFocus></View>diff --git a/packages/desktop-client/src/components/modals/CreateAccountModal.tsx b/packages/desktop-client/src/components/modals/CreateAccountModal.tsxindex 9e0b6db09f..2e29489056 100644--- a/packages/desktop-client/src/components/modals/CreateAccountModal.tsx+++ b/packages/desktop-client/src/components/modals/CreateAccountModal.tsx@@ -359,7 +359,7 @@ export function CreateAccountModal({}}onPress={onCreateLocalAccount}>- {t('Create a local account')}+ <Trans>Create a local account</Trans></Button></InitialFocus><View style={{ lineHeight: '1.4em', fontSize: 15 }}>diff --git a/packages/desktop-client/src/components/modals/CreateEncryptionKeyModal.tsx b/packages/desktop-client/src/components/modals/CreateEncryptionKeyModal.tsxindex 63c5516a91..b04259b1b4 100644--- a/packages/desktop-client/src/components/modals/CreateEncryptionKeyModal.tsx+++ b/packages/desktop-client/src/components/modals/CreateEncryptionKeyModal.tsx@@ -103,7 +103,7 @@ export function CreateEncryptionKeyModal({to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"linkColor="purple">- {t('Learn more')}+ <Trans>Learn more</Trans></Link></Paragraph><Paragraph>diff --git a/packages/desktop-client/src/components/modals/CreateLocalAccountModal.tsx b/packages/desktop-client/src/components/modals/CreateLocalAccountModal.tsxindex ac1dbd6a39..01bdb587c8 100644--- a/packages/desktop-client/src/components/modals/CreateLocalAccountModal.tsx+++ b/packages/desktop-client/src/components/modals/CreateLocalAccountModal.tsx@@ -179,18 +179,20 @@ export function CreateLocalAccountModal() {</InlineField>{balanceError && (<FormError style={{ marginLeft: 75 }}>- {t('Balance must be a number')}+ <Trans>Balance must be a number</Trans></FormError>)}<ModalButtons>- <Button onPress={close}>{t('Back')}</Button>+ <Button onPress={close}>+ <Trans>Back</Trans>+ </Button><Buttontype="submit"variant="primary"style={{ marginLeft: 10 }}>- {t('Create')}+ <Trans>Create</Trans></Button></ModalButtons></Form>diff --git a/packages/desktop-client/src/components/modals/EditAccess.tsx b/packages/desktop-client/src/components/modals/EditAccess.tsxindex 59e31a5e49..dafcb146b6 100644--- a/packages/desktop-client/src/components/modals/EditAccess.tsx+++ b/packages/desktop-client/src/components/modals/EditAccess.tsx@@ -149,7 +149,7 @@ export function EditUserAccess({style={{ marginRight: 10 }}onPress={() => dispatch(popModal())}>- Cancel+ <Trans>Cancel</Trans></Button><Buttonvariant="primary"diff --git a/packages/desktop-client/src/components/modals/EditFieldModal.tsx b/packages/desktop-client/src/components/modals/EditFieldModal.tsxindex 54aa1537e4..2a2e108f36 100644--- a/packages/desktop-client/src/components/modals/EditFieldModal.tsx+++ b/packages/desktop-client/src/components/modals/EditFieldModal.tsx@@ -4,7 +4,7 @@ import React, {useRef,useState,} from 'react';-import { useTranslation } from 'react-i18next';+import { Trans, useTranslation } from 'react-i18next';import { Button } from '@actual-app/components/button';import { useResponsive } from '@actual-app/components/hooks/useResponsive';@@ -140,7 +140,7 @@ export function EditFieldModal({noteInputRef.current?.focus();}}>- {t('Prepend')}+ <Trans>Prepend</Trans></Button><Buttonstyle={{@@ -171,7 +171,7 @@ export function EditFieldModal({noteInputRef.current?.focus();}}>- {t('Replace')}+ <Trans>Replace</Trans></Button><Buttonstyle={{@@ -202,7 +202,7 @@ export function EditFieldModal({noteInputRef.current?.focus();}}>- {t('Append')}+ <Trans>Append</Trans></Button></View><Inputdiff --git a/packages/desktop-client/src/components/modals/EditRuleModal.jsx b/packages/desktop-client/src/components/modals/EditRuleModal.jsxindex 85b9571aac..27e633e002 100644--- a/packages/desktop-client/src/components/modals/EditRuleModal.jsx+++ b/packages/desktop-client/src/components/modals/EditRuleModal.jsx@@ -1298,7 +1298,9 @@ export function EditRuleModal({justify="flex-end"style={{ marginTop: 20 }}>- <Button onClick={close}>{t('Cancel')}</Button>+ <Button onClick={close}>+ <Trans>Cancel</Trans>+ </Button><Button variant="primary" onPress={() => onSave(close)}><Trans>Save</Trans></Button>diff --git a/packages/desktop-client/src/components/modals/EnvelopeBalanceMenuModal.tsx b/packages/desktop-client/src/components/modals/EnvelopeBalanceMenuModal.tsxindex a7b7581f4a..44ad20e3a1 100644--- a/packages/desktop-client/src/components/modals/EnvelopeBalanceMenuModal.tsx+++ b/packages/desktop-client/src/components/modals/EnvelopeBalanceMenuModal.tsx@@ -1,5 +1,5 @@import React, { type CSSProperties } from 'react';-import { useTranslation } from 'react-i18next';+import { Trans } from 'react-i18next';import { styles } from '@actual-app/components/styles';import { Text } from '@actual-app/components/text';@@ -40,7 +40,6 @@ export function EnvelopeBalanceMenuModal({borderTop: `1px solid ${theme.pillBorder}`,};- const { t } = useTranslation();const category = useCategory(categoryId);if (!category) {@@ -68,7 +67,7 @@ export function EnvelopeBalanceMenuModal({fontWeight: 400,}}>- {t('Balance')}+ <Trans>Balance</Trans></Text><BalanceWithCarryoverisDisableddiff --git a/packages/desktop-client/src/components/modals/EnvelopeBudgetMenuModal.tsx b/packages/desktop-client/src/components/modals/EnvelopeBudgetMenuModal.tsxindex 3cb687f6c9..acbb356f5a 100644--- a/packages/desktop-client/src/components/modals/EnvelopeBudgetMenuModal.tsx+++ b/packages/desktop-client/src/components/modals/EnvelopeBudgetMenuModal.tsx@@ -1,5 +1,5 @@import React, { useState, useEffect, type CSSProperties } from 'react';-import { useTranslation } from 'react-i18next';+import { Trans } from 'react-i18next';import { styles } from '@actual-app/components/styles';import { Text } from '@actual-app/components/text';@@ -41,7 +41,6 @@ export function EnvelopeBudgetMenuModal({borderTop: `1px solid ${theme.pillBorder}`,};- const { t } = useTranslation();const budgeted = useEnvelopeSheetValue(envelopeBudget.catBudgeted(categoryId),);@@ -85,7 +84,7 @@ export function EnvelopeBudgetMenuModal({fontWeight: 400,}}>- {t('Budgeted')}+ <Trans>Budgeted</Trans></Text><FocusableAmountInputvalue={integerToAmount(budgeted || 0)}diff --git a/packages/desktop-client/src/components/modals/EnvelopeBudgetMonthMenuModal.tsx b/packages/desktop-client/src/components/modals/EnvelopeBudgetMonthMenuModal.tsxindex 32b1195c63..fab6ce2b1c 100644--- a/packages/desktop-client/src/components/modals/EnvelopeBudgetMonthMenuModal.tsx+++ b/packages/desktop-client/src/components/modals/EnvelopeBudgetMonthMenuModal.tsx@@ -1,6 +1,6 @@// @ts-strict-ignoreimport React, { useState } from 'react';-import { useTranslation } from 'react-i18next';+import { Trans, useTranslation } from 'react-i18next';import { Button } from '@actual-app/components/button';import {@@ -125,7 +125,7 @@ export function EnvelopeBudgetMonthMenuModal({height={20}style={{ paddingRight: 5 }}/>- {t('Edit notes')}+ <Trans>Edit notes</Trans></Button></View><View>@@ -155,7 +155,7 @@ export function EnvelopeBudgetMonthMenuModal({style={{ paddingRight: 5 }}/>)}- {t('Actions')}+ <Trans>Actions</Trans></Button></View></View>diff --git a/packages/desktop-client/src/components/modals/FixEncryptionKeyModal.tsx b/packages/desktop-client/src/components/modals/FixEncryptionKeyModal.tsxindex 235aefed5b..290c76e024 100644--- a/packages/desktop-client/src/components/modals/FixEncryptionKeyModal.tsx+++ b/packages/desktop-client/src/components/modals/FixEncryptionKeyModal.tsx@@ -1,7 +1,7 @@// @ts-strict-ignoreimport React, { useState } from 'react';import { Form } from 'react-aria-components';-import { useTranslation } from 'react-i18next';+import { Trans, useTranslation } from 'react-i18next';import { Button, ButtonWithLoading } from '@actual-app/components/button';import { useResponsive } from '@actual-app/components/hooks/useResponsive';@@ -91,7 +91,7 @@ export function FixEncryptionKeyModal({variant="external"to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption">- {t('Learn more')}+ <Trans>Learn more</Trans></Link></Paragraph>) : (@@ -103,7 +103,7 @@ export function FixEncryptionKeyModal({variant="external"to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption">- {t('Learn more')}+ <Trans>Learn more</Trans></Link></Paragraph>)}@@ -122,7 +122,7 @@ export function FixEncryptionKeyModal({}}><Text style={{ fontWeight: 600, marginBottom: 5 }}>- {t('Password')}+ <Trans>Password</Trans></Text>{' '}{error && (<View@@ -152,7 +152,7 @@ export function FixEncryptionKeyModal({type="checkbox"onClick={() => setShowPassword(!showPassword)}/>{' '}- {t('Show password')}+ <Trans>Show password</Trans></label></Text></View>@@ -166,7 +166,7 @@ export function FixEncryptionKeyModal({}}onPress={close}>- {t('Back')}+ <Trans>Back</Trans></Button><ButtonWithLoadingtype="submit"diff --git a/packages/desktop-client/src/components/modals/HoldBufferModal.tsx b/packages/desktop-client/src/components/modals/HoldBufferModal.tsxindex 80beaba805..428e66f39e 100644--- a/packages/desktop-client/src/components/modals/HoldBufferModal.tsx+++ b/packages/desktop-client/src/components/modals/HoldBufferModal.tsx@@ -1,5 +1,5 @@import React, { useEffect, useState } from 'react';-import { useTranslation } from 'react-i18next';+import { Trans, useTranslation } from 'react-i18next';import { Button } from '@actual-app/components/button';import { InitialFocus } from '@actual-app/components/initial-focus';@@ -83,7 +83,7 @@ export function HoldBufferModal({ onSubmit }: HoldBufferModalProps) {}}onPress={() => _onSubmit(amount)}>- {t('Hold')}+ <Trans>Hold</Trans></Button></View></>diff --git a/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.jsx b/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.jsxindex e21203b4f6..34e1ec1e12 100644--- a/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.jsx+++ b/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.jsx@@ -807,7 +807,7 @@ export function ImportTransactionsModal({fontStyle: 'italic',}}>- {t('No transactions found')}+ <Trans>No transactions found</Trans></View>);}}@@ -914,7 +914,7 @@ export function ImportTransactionsModal({setReconcile(!reconcile);}}>- {t('Merge with existing transactions')}+ <Trans>Merge with existing transactions</Trans></CheckboxOption>)}@@ -954,7 +954,7 @@ export function ImportTransactionsModal({alignItems: 'baseline',}}>- {t('Delimiter:')}+ <Trans>Delimiter:</Trans><Selectoptions={[[',', ','],@@ -986,7 +986,7 @@ export function ImportTransactionsModal({alignItems: 'baseline',}}>- {t('Skip lines:')}+ <Trans>Skip lines:</Trans><Inputtype="number"value={skipLines}diff --git a/packages/desktop-client/src/components/modals/ImportTransactionsModal/Transaction.tsx b/packages/desktop-client/src/components/modals/ImportTransactionsModal/Transaction.tsxindex 0417770c6a..ba5bfed934 100644--- a/packages/desktop-client/src/components/modals/ImportTransactionsModal/Transaction.tsx+++ b/packages/desktop-client/src/components/modals/ImportTransactionsModal/Transaction.tsx@@ -128,7 +128,7 @@ export function Transaction({background:theme.checkboxBackgroundSelected +// update sign from packages/desktop-client/src/icons/v1/layer.svg- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typography' url(\'data:image/svg+xml; utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="white" d="M10 1l10 6-10 6L0 7l10-6zm6.67 10L20 13l-10 6-10-6 3.33-2L10 15l6.67-4z" /></svg>\') 9px 9px',},},@@ -143,11 +143,11 @@ export function Transaction({background:theme.buttonNormalDisabledBorder +// minus sign adapted from packages/desktop-client/src/icons/v1/add.svg- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typography' url(\'data:image/svg+xml; utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="white" className="path" d="M23,11.5 L23,11.5 L23,11.5 C23,12.3284271 22.3284271,13 21.5,13 L1.5,13 L1.5,13 C0.671572875,13 1.01453063e-16,12.3284271 0,11.5 L0,11.5 L0,11.5 C-1.01453063e-16,10.6715729 0.671572875,10 1.5,10 L21.5,10 L21.5,10 C22.3284271,10 23,10.6715729 23,11.5 Z" /></svg>\') 9px 9px',width: 9,height: 9,- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typographycontent: '" "',},},@@ -158,7 +158,7 @@ export function Transaction({background:theme.checkboxBackgroundSelected +// plus sign from packages/desktop-client/src/icons/v1/add.svg- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typography' url(\'data:image/svg+xml; utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="white" className="path" d="M23,11.5 L23,11.5 L23,11.5 C23,12.3284271 22.3284271,13 21.5,13 L1.5,13 L1.5,13 C0.671572875,13 1.01453063e-16,12.3284271 0,11.5 L0,11.5 L0,11.5 C-1.01453063e-16,10.6715729 0.671572875,10 1.5,10 L21.5,10 L21.5,10 C22.3284271,10 23,10.6715729 23,11.5 Z" /><path fill="white" className="path" d="M11.5,23 C10.6715729,23 10,22.3284271 10,21.5 L10,1.5 C10,0.671572875 10.6715729,1.52179594e-16 11.5,0 C12.3284271,-1.52179594e-16 13,0.671572875 13,1.5 L13,21.5 C13,22.3284271 12.3284271,23 11.5,23 Z" /></svg>\') 9px 9px',},},diff --git a/packages/desktop-client/src/components/modals/MergeUnusedPayeesModal.tsx b/packages/desktop-client/src/components/modals/MergeUnusedPayeesModal.tsxindex dead5fb23a..3c876eef92 100644--- a/packages/desktop-client/src/components/modals/MergeUnusedPayeesModal.tsx+++ b/packages/desktop-client/src/components/modals/MergeUnusedPayeesModal.tsx@@ -1,5 +1,5 @@import React, { useState, useRef, useEffect, useCallback } from 'react';-import { useTranslation } from 'react-i18next';+import { Trans } from 'react-i18next';import { Button } from '@actual-app/components/button';import { Paragraph } from '@actual-app/components/paragraph';@@ -9,6 +9,7 @@ import { View } from '@actual-app/components/view';import { send } from 'loot-core/platform/client/fetch';import { type PayeeEntity } from 'loot-core/types/models';+import { type TransObjectLiteral } from 'loot-core/types/util';import { Information } from '@desktop-client/components/alerts';import { Modal, ModalButtons } from '@desktop-client/components/common/Modal';@@ -30,7 +31,6 @@ export function MergeUnusedPayeesModal({payeeIds,targetPayeeId,}: MergeUnusedPayeesModalProps) {- const { t } = useTranslation();const allPayees = usePayees();const modalStack = useSelector(state => state.modals.modalStack);const isEditingRule = !!modalStack.find(m => m.name === 'edit-rule');@@ -109,16 +109,28 @@ export function MergeUnusedPayeesModal({<View><Paragraph style={{ marginBottom: 10, fontWeight: 500 }}>{payees.length === 1 ? (- <>- The payee <Text style={highlightStyle}>{payees[0].name}</Text>{' '}- is not used by transactions any more. Would like to merge it- with <Text style={highlightStyle}>{targetPayee.name}</Text>?- </>+ <Trans>+ The payee{' '}+ <Text style={highlightStyle}>+ {{ payee: payees[0].name } as TransObjectLiteral}+ </Text>{' '}+ is not used by transactions any more. Would you like to merge+ it with{' '}+ <Text style={highlightStyle}>+ {{ payee: targetPayee.name } as TransObjectLiteral}+ </Text>+ ?+ </Trans>) : (<>- The following payees are not used by transactions any more.- Would like to merge them with{' '}- <Text style={highlightStyle}>{targetPayee.name}</Text>?+ <Trans>+ The following payees are not used by transactions any more.+ Would you like to merge them with{' '}+ <Text style={highlightStyle}>+ {{ payee: targetPayee.name } as TransObjectLiteral}+ </Text>+ ?+ </Trans><ulref={flashRef}style={{@@ -139,15 +151,15 @@ export function MergeUnusedPayeesModal({</Paragraph><Information>- {t(- 'Merging will remove the payee and transfer any existing rules to the new payee.',- )}+ <Trans>+ Merging will remove the payee and transfer any existing rules to+ the new payee.+ </Trans>{!isEditingRule && (- <>- {' '}+ <Trans>If checked below, a rule will be created to do this renamewhile importing transactions.- </>+ </Trans>)}</Information>@@ -169,9 +181,9 @@ export function MergeUnusedPayeesModal({onChange={e => setShouldCreateRule(e.target.checked)}/><Text style={{ marginLeft: 3 }}>- Automatically rename{' '}- {payees.length === 1 ? 'this payee' : 'these payees'} in the- future+ <Trans count={payees.length}>+ Automatically rename these payees in the future+ </Trans></Text></label>)}@@ -186,7 +198,7 @@ export function MergeUnusedPayeesModal({close();}}>- {t('Merge')}+ <Trans>Merge</Trans></Button>{!isEditingRule && (<Button@@ -196,11 +208,11 @@ export function MergeUnusedPayeesModal({close();}}>- {t('Merge and edit rule')}+ <Trans>Merge and edit rule</Trans></Button>)}<Button style={{ marginRight: 10 }} onPress={close}>- {t('Do nothing')}+ <Trans>Do nothing</Trans></Button></ModalButtons></View>diff --git a/packages/desktop-client/src/components/modals/NotesModal.tsx b/packages/desktop-client/src/components/modals/NotesModal.tsxindex 808edb4c29..1e7ca0db1f 100644--- a/packages/desktop-client/src/components/modals/NotesModal.tsx+++ b/packages/desktop-client/src/components/modals/NotesModal.tsx@@ -1,6 +1,6 @@// @ts-strict-ignoreimport React, { useEffect, useState } from 'react';-import { useTranslation } from 'react-i18next';+import { Trans, useTranslation } from 'react-i18next';import { Button } from '@actual-app/components/button';import { SvgCheck } from '@actual-app/components/icons/v2';@@ -82,7 +82,7 @@ export function NotesModal({ id, name, onSave }: NotesModalProps) {}}><SvgCheck width={17} height={17} style={{ paddingRight: 5 }} />- {t('Save notes')}+ <Trans>Save notes</Trans></Button></View></View>diff --git a/packages/desktop-client/src/components/modals/ScheduledTransactionMenuModal.tsx b/packages/desktop-client/src/components/modals/ScheduledTransactionMenuModal.tsxindex a395c38ba4..1b69e6cc22 100644--- a/packages/desktop-client/src/components/modals/ScheduledTransactionMenuModal.tsx+++ b/packages/desktop-client/src/components/modals/ScheduledTransactionMenuModal.tsx@@ -3,7 +3,7 @@ import React, {type ComponentPropsWithoutRef,type CSSProperties,} from 'react';-import { useTranslation } from 'react-i18next';+import { Trans, useTranslation } from 'react-i18next';import { Menu } from '@actual-app/components/menu';import { styles } from '@actual-app/components/styles';@@ -40,7 +40,6 @@ export function ScheduledTransactionMenuModal({onComplete,}: ScheduledTransactionMenuModalProps) {const locale = useLocale();- const { t } = useTranslation();const defaultMenuItemStyle: CSSProperties = {...styles.mobileMenuItem,color: theme.menuItemText,@@ -82,7 +81,7 @@ export function ScheduledTransactionMenuModal({}}><Text style={{ fontSize: 17, fontWeight: 400 }}>- {t('Scheduled date')}+ <Trans>Scheduled date</Trans></Text><Text style={{ fontSize: 17, fontWeight: 700 }}>{format(schedule?.next_date || '', 'MMMM dd, yyyy', locale)}diff --git a/packages/desktop-client/src/components/modals/TrackingBalanceMenuModal.tsx b/packages/desktop-client/src/components/modals/TrackingBalanceMenuModal.tsxindex e3c0885d9d..a61eb19520 100644--- a/packages/desktop-client/src/components/modals/TrackingBalanceMenuModal.tsx+++ b/packages/desktop-client/src/components/modals/TrackingBalanceMenuModal.tsx@@ -1,5 +1,5 @@import React, { type CSSProperties } from 'react';-import { useTranslation } from 'react-i18next';+import { Trans } from 'react-i18next';import { styles } from '@actual-app/components/styles';import { Text } from '@actual-app/components/text';@@ -38,7 +38,6 @@ export function TrackingBalanceMenuModal({borderTop: `1px solid ${theme.pillBorder}`,};- const { t } = useTranslation();const category = useCategory(categoryId);if (!category) {@@ -66,7 +65,7 @@ export function TrackingBalanceMenuModal({fontWeight: 400,}}>- {t('Balance')}+ <Trans>Balance</Trans></Text><BalanceWithCarryoverisDisableddiff --git a/packages/desktop-client/src/components/modals/TrackingBudgetMenuModal.tsx b/packages/desktop-client/src/components/modals/TrackingBudgetMenuModal.tsxindex b6529a9d23..2475ef2bd6 100644--- a/packages/desktop-client/src/components/modals/TrackingBudgetMenuModal.tsx+++ b/packages/desktop-client/src/components/modals/TrackingBudgetMenuModal.tsx@@ -1,5 +1,5 @@import React, { useState, useEffect, type CSSProperties } from 'react';-import { useTranslation } from 'react-i18next';+import { Trans } from 'react-i18next';import { styles } from '@actual-app/components/styles';import { Text } from '@actual-app/components/text';@@ -41,7 +41,6 @@ export function TrackingBudgetMenuModal({borderTop: `1px solid ${theme.pillBorder}`,};- const { t } = useTranslation();const budgeted = useTrackingSheetValue(trackingBudget.catBudgeted(categoryId),);@@ -85,7 +84,7 @@ export function TrackingBudgetMenuModal({fontWeight: 400,}}>- {t('Budgeted')}+ <Trans>Budgeted</Trans></Text><FocusableAmountInputvalue={integerToAmount(budgeted || 0)}diff --git a/packages/desktop-client/src/components/modals/TrackingBudgetMonthMenuModal.tsx b/packages/desktop-client/src/components/modals/TrackingBudgetMonthMenuModal.tsxindex 15b4262a66..3e11e14b6b 100644--- a/packages/desktop-client/src/components/modals/TrackingBudgetMonthMenuModal.tsx+++ b/packages/desktop-client/src/components/modals/TrackingBudgetMonthMenuModal.tsx@@ -1,6 +1,6 @@// @ts-strict-ignoreimport React, { useState } from 'react';-import { useTranslation } from 'react-i18next';+import { Trans, useTranslation } from 'react-i18next';import { Button } from '@actual-app/components/button';import {@@ -127,7 +127,7 @@ export function TrackingBudgetMonthMenuModal({height={20}style={{ paddingRight: 5 }}/>- {t('Edit notes')}+ <Trans>Edit notes</Trans></Button></View><View>@@ -157,7 +157,7 @@ export function TrackingBudgetMonthMenuModal({style={{ paddingRight: 5 }}/>)}- {t('Actions')}+ <Trans>Actions</Trans></Button></View></View>diff --git a/packages/desktop-client/src/components/modals/TransferOwnership.tsx b/packages/desktop-client/src/components/modals/TransferOwnership.tsxindex cea034d7ab..32d0619a39 100644--- a/packages/desktop-client/src/components/modals/TransferOwnership.tsx+++ b/packages/desktop-client/src/components/modals/TransferOwnership.tsx@@ -132,9 +132,10 @@ export function TransferOwnership({marginTop: 5,}}>- {t(- 'Select a user from the directory to designate as the new budget owner.',- )}+ <Trans>+ Select a user from the directory to designate as the new+ budget owner.+ </Trans></label><labelstyle={{@@ -154,7 +155,7 @@ export function TransferOwnership({marginTop: 5,}}>- {t('Proceed with caution.')}+ <Trans>Proceed with caution.</Trans></label></View>)}@@ -166,7 +167,7 @@ export function TransferOwnership({marginTop: 5,}}>- {t('No users available')}+ <Trans>No users available</Trans></Text>)}</FormField>diff --git a/packages/desktop-client/src/components/payees/ManagePayees.tsx b/packages/desktop-client/src/components/payees/ManagePayees.tsxindex 37c08f85a2..fa2bb6429f 100644--- a/packages/desktop-client/src/components/payees/ManagePayees.tsx+++ b/packages/desktop-client/src/components/payees/ManagePayees.tsx@@ -313,7 +313,7 @@ export const ManagePayees = ({marginTop: 5,}}>- {t('No payees')}+ <Trans>No payees</Trans></View>) : (<PayeeTablediff --git a/packages/desktop-client/src/components/reports/ReportOptions.ts b/packages/desktop-client/src/components/reports/ReportOptions.tsindex a42c2cb3ad..5f11590f82 100644--- a/packages/desktop-client/src/components/reports/ReportOptions.ts+++ b/packages/desktop-client/src/components/reports/ReportOptions.ts@@ -214,7 +214,7 @@ const intervalOptions: intervalOptionsProps[] = [description: t('Monthly'),key: 'Monthly',name: 'Month',- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typographyformat: "MMM ''yy",range: 'rangeInclusive',},diff --git a/packages/desktop-client/src/components/reports/ReportSidebar.tsx b/packages/desktop-client/src/components/reports/ReportSidebar.tsxindex 797887700e..471e75ead5 100644--- a/packages/desktop-client/src/components/reports/ReportSidebar.tsx+++ b/packages/desktop-client/src/components/reports/ReportSidebar.tsx@@ -472,7 +472,7 @@ export function ReportSidebar({onSelectRange(customReportItems.dateRange);}}>- Live+ <Trans>Live</Trans></ModeButton><ModeButtonselected={customReportItems.isDateStatic}@@ -509,7 +509,11 @@ export function ReportSidebar({customReportItems.includeCurrentInterval && (<Tooltipplacement="bottom start"- content={<Text>{t('Current month')}</Text>}+ content={+ <Text>+ <Trans>Current month</Trans>+ </Text>+ }style={{...styles.tooltip,lineHeight: 1.5,diff --git a/packages/desktop-client/src/components/reports/ReportSummary.tsx b/packages/desktop-client/src/components/reports/ReportSummary.tsxindex e30ce2129b..66557eee68 100644--- a/packages/desktop-client/src/components/reports/ReportSummary.tsx+++ b/packages/desktop-client/src/components/reports/ReportSummary.tsx@@ -169,7 +169,14 @@ export function ReportSummary({</PrivacyFilter></Text><Text style={{ fontWeight: 600 }}>- Per {(ReportOptions.intervalMap.get(interval) || '').toLowerCase()}+ <Trans>+ Per{' '}+ {{+ interval: (+ ReportOptions.intervalMap.get(interval) || ''+ ).toLowerCase(),+ }}+ </Trans></Text></View></View>diff --git a/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.tsx b/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.tsxindex a73c44f975..0385a8a615 100644--- a/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.tsx+++ b/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.tsx@@ -139,7 +139,7 @@ export function CashFlowGraph({dataKey="date"tick={{ fill: theme.reportsLabel }}tickFormatter={x => {- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typographyreturn d.format(x, isConcise ? "MMM ''yy" : 'MMM d', {locale,});@@ -159,7 +159,7 @@ export function CashFlowGraph({/><TooltiplabelFormatter={x => {- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typographyreturn d.format(x, isConcise ? "MMM ''yy" : 'MMM d', {locale,});diff --git a/packages/desktop-client/src/components/reports/reports/Summary.tsx b/packages/desktop-client/src/components/reports/reports/Summary.tsxindex beeccd2cf9..d1382bb7dc 100644--- a/packages/desktop-client/src/components/reports/reports/Summary.tsx+++ b/packages/desktop-client/src/components/reports/reports/Summary.tsx@@ -326,7 +326,9 @@ function SummaryInner({ widget }: SummaryInnerProps) {padding: 16,}}>- <span style={{ marginRight: 4 }}>{t('Show as')}</span>+ <span style={{ marginRight: 4 }}>+ <Trans>Show as</Trans>+ </span><FieldSelectstyle={{ marginRight: 16 }}fields={[diff --git a/packages/desktop-client/src/components/rules/RuleRow.tsx b/packages/desktop-client/src/components/rules/RuleRow.tsxindex 18c58838fa..dae17a8ccb 100644--- a/packages/desktop-client/src/components/rules/RuleRow.tsx+++ b/packages/desktop-client/src/components/rules/RuleRow.tsx@@ -1,6 +1,6 @@// @ts-strict-ignoreimport React, { memo, useRef } from 'react';-import { useTranslation } from 'react-i18next';+import { Trans, useTranslation } from 'react-i18next';import { Button } from '@actual-app/components/button';import { SvgRightArrow2 } from '@actual-app/components/icons/v0';@@ -219,7 +219,9 @@ export const RuleRow = memo(</Field><Cell name="edit" plain style={{ padding: '0 15px', paddingLeft: 5 }}>- <Button onPress={() => onEditRule(rule)}>{t('Edit')}</Button>+ <Button onPress={() => onEditRule(rule)}>+ <Trans>Edit</Trans>+ </Button></Cell></Row>);diff --git a/packages/desktop-client/src/components/select/RecurringSchedulePicker.tsx b/packages/desktop-client/src/components/select/RecurringSchedulePicker.tsxindex 6326a03108..c2047b1f6f 100644--- a/packages/desktop-client/src/components/select/RecurringSchedulePicker.tsx+++ b/packages/desktop-client/src/components/select/RecurringSchedulePicker.tsx@@ -484,7 +484,9 @@ function RecurringScheduleTooltip({style={{ marginTop: 10 }}spacing={1}>- <Text style={{ whiteSpace: 'nowrap' }}>{t('Repeat every')}</Text>+ <Text style={{ whiteSpace: 'nowrap' }}>+ <Trans>Repeat every</Trans>+ </Text><Inputid="interval"style={{ width: 40 }}@@ -507,7 +509,7 @@ function RecurringScheduleTooltip({}}onPress={() => dispatch({ type: 'add-recurrence' })}>- {t('Add specific days')}+ <Trans>Add specific days</Trans></Button>) : null}</Stack>diff --git a/packages/desktop-client/src/components/settings/Export.tsx b/packages/desktop-client/src/components/settings/Export.tsxindex 42f39610f7..c87e69c530 100644--- a/packages/desktop-client/src/components/settings/Export.tsx+++ b/packages/desktop-client/src/components/settings/Export.tsx@@ -48,7 +48,7 @@ export function ExportBudget() {primaryAction={<><ButtonWithLoading onPress={onExport} isLoading={isLoading}>- {t('Export data')}+ <Trans>Export data</Trans></ButtonWithLoading>{error && (<Block style={{ color: theme.errorText, marginTop: 15 }}>diff --git a/packages/desktop-client/src/hooks/useFormat.ts b/packages/desktop-client/src/hooks/useFormat.tsindex a28872a115..d8a1e394f6 100644--- a/packages/desktop-client/src/hooks/useFormat.ts+++ b/packages/desktop-client/src/hooks/useFormat.ts@@ -47,7 +47,7 @@ function format(switch (type) {case 'string': {const val = JSON.stringify(value);- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typographyif (val.charAt(0) === '"' && val.charAt(val.length - 1) === '"') {return { formattedString: val.slice(1, -1) };}diff --git a/packages/eslint-plugin-actual/lib/index.js b/packages/eslint-plugin-actual/lib/index.jsnew file mode 100644index 0000000000..2d10052aeb--- /dev/null+++ b/packages/eslint-plugin-actual/lib/index.js@@ -0,0 +1,8 @@+module.exports = {+ rules: {+ 'no-untranslated-strings': require('./rules/no-untranslated-strings'),+ 'prefer-trans-over-t': require('./rules/prefer-trans-over-t'),+ typography: require('./rules/typography'),+ 'prefer-if-statement': require('./rules/prefer-if-statement'),+ },+};diff --git a/packages/eslint-plugin-actual/lib/rules/no-untranslated-strings.js b/packages/eslint-plugin-actual/lib/rules/no-untranslated-strings.jsnew file mode 100644index 0000000000..db2ec376b6--- /dev/null+++ b/packages/eslint-plugin-actual/lib/rules/no-untranslated-strings.js@@ -0,0 +1,89 @@+/** @type {import('eslint').Rule.RuleModule} */+module.exports = {+ meta: {+ type: 'problem',+ docs: {+ description: 'Disallow non-translated English strings',+ recommended: true,+ },+ schema: [],+ messages: {+ noHardcoded: 'Non-translated English string. Wrap in <Trans>.',+ },+ },+ create(context) {+ const whitelist = [+ 'Actual',+ 'GoCardless',+ 'SimpleFIN',+ 'Pluggy.ai',+ 'YNAB',+ 'nYNAB',+ 'YNAB4',++ '0',+ '1',+ '2',+ '3',+ '4',+ '5',+ '6',+ '7',+ '8',+ '9',+ ];++ function isProbablyEnglish(text) {+ const trimmed = text.trim();+ if (whitelist.includes(trimmed)) {+ return false;+ }++ // very basic - but it'll catch most cases+ return /^[A-Z][a-z].*[a-z](\p{P})?$/.test(trimmed);+ }++ function isInsideTrans(node) {+ let parent = node.parent;+ while (parent) {+ if (parent.type === 'JSXElement') {+ const elementName = parent.openingElement.name;+ // Check for both JSXIdentifier and JSXMemberExpression (e.g., Trans.Provider)+ if (+ elementName.type === 'JSXIdentifier' &&+ elementName.name === 'Trans'+ ) {+ return true;+ }+ if (+ elementName.type === 'JSXMemberExpression' &&+ elementName.object.name === 'Trans'+ ) {+ return true;+ }+ }+ parent = parent.parent;+ }+ return false;+ }++ return {+ JSXText(node) {+ if (isProbablyEnglish(node.value) && !isInsideTrans(node)) {+ context.report({ node, messageId: 'noHardcoded' });+ }+ },+ Literal(node) {+ if (+ node.parent &&+ node.parent.type === 'JSXExpressionContainer' &&+ typeof node.value === 'string' &&+ isProbablyEnglish(node.value) &&+ !isInsideTrans(node)+ ) {+ context.report({ node, messageId: 'noHardcoded' });+ }+ },+ };+ },+};diff --git a/packages/eslint-plugin-actual/lib/rules/prefer-trans-over-t.js b/packages/eslint-plugin-actual/lib/rules/prefer-trans-over-t.jsnew file mode 100644index 0000000000..ef345b6b00--- /dev/null+++ b/packages/eslint-plugin-actual/lib/rules/prefer-trans-over-t.js@@ -0,0 +1,153 @@+/** @type {import('eslint').Rule.RuleModule} */+module.exports = {+ meta: {+ type: 'suggestion',+ docs: {+ description: 'Prefer <Trans> over t() for simple text content in JSX',+ recommended: true,+ },+ schema: [],+ messages: {+ // eslint-disable-next-line actual/typography+ preferTrans: "Prefer <Trans>{{ text }}</Trans> over t('{{ text }}')",+ },+ fixable: 'code',+ },+ create(context) {+ const simpleTextPattern = /^[A-Z][a-z\s]*[a-z](\p{P})?$/u;++ function isSimpleText(text) {+ const trimmed = text.trim();+ if (trimmed === '') return false;++ // Skip if it contains interpolation or complex patterns+ if (trimmed.includes('{{') || trimmed.includes('}}')) return false;+ if (trimmed.includes('\\') || trimmed.includes('`')) return false;++ return simpleTextPattern.test(trimmed);+ }++ function isJSXContent(node) {+ let parent = node.parent;++ // We don't want to outlaw t() calls in these contexts+ const disallowedTypes = [+ 'AssignmentExpression', // title = t('Text')+ 'VariableDeclarator', // const title = t('Text')+ 'JSXAttribute', // title={t('Text')}+ 'JSXOpeningElement', // <div title={t('Text')}>+ 'ConditionalExpression', // condition ? t('Yes') : t('No')+ 'LogicalExpression', // condition && t('Text')+ 'CallExpression', // someFunction(t('Text'))+ 'Property', // { title: t('Text') }+ ];++ while (parent) {+ if (disallowedTypes.includes(parent.type)) {+ return false;+ }++ if (parent.type === 'ReturnStatement') {+ // Checks if return statement is inside JSX context+ // return <div>{t('Text')}</div> - WILL flag+ // return t('Text') - will NOT flag+ let returnParent = parent.parent;+ while (returnParent) {+ if (returnParent.type === 'JSXElement') {+ break;+ }+ if (+ returnParent.type === 'FunctionDeclaration' ||+ returnParent.type === 'FunctionExpression' ||+ returnParent.type === 'ArrowFunctionExpression'+ ) {+ return false;+ }+ returnParent = returnParent.parent;+ }+ }++ if (parent.type === 'JSXExpressionContainer') {+ // Checks if expression container is inside JSX children (not attributes)+ // <div>{t('Text')}</div> - WILL flag+ // <div title={t('Text')}></div> - will NOT flag+ let containerParent = parent.parent;+ while (containerParent) {+ if (containerParent.type === 'JSXAttribute') {+ return false;+ }+ if (containerParent.type === 'JSXOpeningElement') {+ return false;+ }+ if (containerParent.type === 'JSXElement') {+ const children = containerParent.children || [];+ return children.some(child => child === parent || child === node);+ }+ containerParent = containerParent.parent;+ }+ return true;+ }++ if (parent.type === 'JSXElement') {+ // <div>{t('Text')}</div> - WILL flag+ // <div title={t('Text')}></div> - will NOT flag+ const children = parent.children || [];+ return children.some(+ child =>+ child === node ||+ (child.type === 'JSXExpressionContainer' &&+ child.expression === node),+ );+ }++ parent = parent.parent;+ }++ return false;+ }++ return {+ CallExpression(node) {+ if (+ node.callee.type === 'Identifier' &&+ node.callee.name === 't' &&+ node.arguments.length === 1 &&+ node.arguments[0].type === 'Literal' &&+ typeof node.arguments[0].value === 'string' &&+ isSimpleText(node.arguments[0].value) &&+ isJSXContent(node)+ ) {+ context.report({+ node,+ messageId: 'preferTrans',+ data: {+ text: node.arguments[0].value,+ },+ fix(fixer) {+ const text = node.arguments[0].value;+ const sourceCode = context.getSourceCode();+ const program = sourceCode.ast;++ const fixes = [fixer.replaceText(node, `<Trans>${text}</Trans>`)];++ const firstImport = program.body.find(+ n => n.type === 'ImportDeclaration',+ );+ if (firstImport) {+ fixes.unshift(+ fixer.insertTextAfter(+ firstImport,+ // eslint-disable-next-line actual/typography+ "\nimport { Trans } from 'react-i18next';",+ ),+ );+ }++ return fixes;+ },+ });+ }+ },+ };+ },+};diff --git a/packages/eslint-plugin-actual/lib/rules/typography.js b/packages/eslint-plugin-actual/lib/rules/typography.jsindex 2eb4cf866d..e05e084bb2 100644--- a/packages/eslint-plugin-actual/lib/rules/typography.js+++ b/packages/eslint-plugin-actual/lib/rules/typography.js@@ -13,7 +13,7 @@ module.exports = {fixable: null,schema: [],messages: {- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typographyquote: `Avoid using straight quotes (' or ") in user-visible text. Use curly quotes (‘ ’ or “ ”) instead.`,},},@@ -26,7 +26,7 @@ module.exports = {//----------------------------------------------------------------------function check(node, { value = node.value, strip = false } = {}) {- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typographyif (!value.includes("'") && !value.includes('"')) return;let rawText = context.getSourceCode().getText(node);diff --git a/packages/loot-core/migrations/1722804019000_create_dashboard_table.js b/packages/loot-core/migrations/1722804019000_create_dashboard_table.jsindex fbed322fce..7ccbafb982 100644--- a/packages/loot-core/migrations/1722804019000_create_dashboard_table.js+++ b/packages/loot-core/migrations/1722804019000_create_dashboard_table.js@@ -1,6 +1,6 @@import { v4 as uuidv4 } from 'uuid';-/* eslint-disable rulesdir/typography */+/* eslint-disable actual/typography */export default async function runMigration(db) {db.transaction(() => {db.execQuery(`diff --git a/packages/loot-core/src/server/aql/compiler.ts b/packages/loot-core/src/server/aql/compiler.tsindex d35477b47f..5dda25fa37 100644--- a/packages/loot-core/src/server/aql/compiler.ts+++ b/packages/loot-core/src/server/aql/compiler.ts@@ -38,7 +38,7 @@ function isKeyword(str) {}export function quoteAlias(alias) {- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typographyreturn alias.indexOf('.') === -1 && !isKeyword(alias) ? alias : `"${alias}"`;}@@ -342,7 +342,7 @@ function val(state, expr, type?: string) {}if (castedExpr.literal) {- /* eslint-disable rulesdir/typography */+ /* eslint-disable actual/typography */if (castedExpr.type === 'id') {return `'${castedExpr.value}'`;} else if (castedExpr.type === 'string') {@@ -350,7 +350,7 @@ function val(state, expr, type?: string) {const value = castedExpr.value.replace(/'/g, "''");return `'${value}'`;}- /* eslint-enable rulesdir/typography */+ /* eslint-enable actual/typography */}return castedExpr.value;@@ -718,7 +718,7 @@ const compileOp = saveStack('op', (state, fieldRef, opData) => {const [left, right] = valArray(state, [lhs, rhs], [null, 'array']);// Dedupe the idsconst ids = [...new Set(right)];- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typographyreturn `${left} IN (` + ids.map(id => `'${id}'`).join(',') + ')';}case '$like': {diff --git a/packages/loot-core/src/server/aql/schema/index.ts b/packages/loot-core/src/server/aql/schema/index.tsindex 18f1239081..606116af55 100644--- a/packages/loot-core/src/server/aql/schema/index.ts+++ b/packages/loot-core/src/server/aql/schema/index.ts@@ -304,7 +304,7 @@ export const schemaConfig: SchemaConfig = {schedules: {v_schedules: internalFields => {- /* eslint-disable rulesdir/typography */+ /* eslint-disable actual/typography */const fields = internalFields({next_date: `CASE@@ -328,7 +328,7 @@ export const schemaConfig: SchemaConfig = {LEFT JOIN rules _rules ON _rules.id = _.ruleLEFT JOIN payee_mapping pm ON pm.id = json_extract(_rules.conditions, _paths.payee || '.value')`;- /* eslint-enable rulesdir/typography */+ /* eslint-enable actual/typography */},},diff --git a/packages/loot-core/src/server/budget/statements.ts b/packages/loot-core/src/server/budget/statements.tsindex 4547c5cdc2..b2658578f2 100644--- a/packages/loot-core/src/server/budget/statements.ts+++ b/packages/loot-core/src/server/budget/statements.ts@@ -3,7 +3,7 @@ import { DbSchedule } from '../db';import { GOAL_PREFIX, TEMPLATE_PREFIX } from './template-notes';-/* eslint-disable rulesdir/typography */+/* eslint-disable actual/typography */export async function resetCategoryGoalDefsWithNoTemplates(): Promise<void> {await db.run(`@@ -17,7 +17,7 @@ export async function resetCategoryGoalDefsWithNoTemplates(): Promise<void> {);}-/* eslint-enable rulesdir/typography */+/* eslint-enable actual/typography */export type CategoryWithTemplateNote = {id: string;diff --git a/packages/loot-core/src/server/db/index.ts b/packages/loot-core/src/server/db/index.tsindex 0d44b1988e..d5f3fccdda 100644--- a/packages/loot-core/src/server/db/index.ts+++ b/packages/loot-core/src/server/db/index.ts@@ -662,7 +662,7 @@ export function getCommonPayees() {`);}-/* eslint-disable rulesdir/typography */+/* eslint-disable actual/typography */const orphanedPayeesQuery = `SELECT p.idFROM payees p@@ -680,7 +680,7 @@ const orphanedPayeesQuery = `AND json_extract(cond.value, '$.value') = pm.targetId);`;-/* eslint-enable rulesdir/typography */+/* eslint-enable actual/typography */export function syncGetOrphanedPayees() {return all<Pick<DbPayee, 'id'>>(orphanedPayeesQuery);diff --git a/packages/loot-core/src/server/db/util.ts b/packages/loot-core/src/server/db/util.tsindex c9814712e9..da601ef5cb 100644--- a/packages/loot-core/src/server/db/util.ts+++ b/packages/loot-core/src/server/db/util.ts@@ -30,7 +30,7 @@ export async function incrFetch(export function whereIn(ids: string[], field: string) {const ids2 = [...new Set(ids)];- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typographyconst filter = `${field} IN (` + ids2.map(id => `'${id}'`).join(',') + ')';return filter;}diff --git a/packages/loot-core/src/server/transactions/import/ofx2json.ts b/packages/loot-core/src/server/transactions/import/ofx2json.tsindex d93b8929ce..03b127d818 100644--- a/packages/loot-core/src/server/transactions/import/ofx2json.ts+++ b/packages/loot-core/src/server/transactions/import/ofx2json.ts@@ -33,8 +33,8 @@ export function html2Plain(value) {return value?.replace(/</g, '<') // lessthan.replace(/>/g, '>') // greaterthan- .replace(/'/g, "'") // eslint-disable-line rulesdir/typography- .replace(/"/g, '"') // eslint-disable-line rulesdir/typography+ .replace(/'/g, "'") // eslint-disable-line actual/typography+ .replace(/"/g, '"') // eslint-disable-line actual/typography.replace(/(&|&)/g, '&'); // ampersands}diff --git a/packages/loot-core/src/server/transactions/import/parse-file.ts b/packages/loot-core/src/server/transactions/import/parse-file.tsindex d76fd0dd4e..d2d513f161 100644--- a/packages/loot-core/src/server/transactions/import/parse-file.ts+++ b/packages/loot-core/src/server/transactions/import/parse-file.ts@@ -72,7 +72,7 @@ async function parseCSV(columns: options?.hasHeaderRow,bom: true,delimiter: options?.delimiter || ',',- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typographyquote: '"',trim: true,relax_column_count: true,diff --git a/packages/loot-core/src/server/transactions/index.ts b/packages/loot-core/src/server/transactions/index.tsindex eda7a4b311..7ef4ab5d11 100644--- a/packages/loot-core/src/server/transactions/index.ts+++ b/packages/loot-core/src/server/transactions/index.ts@@ -31,7 +31,7 @@ async function getTransactionsByIds(return incrFetch((query, params) => db.selectWithSchema('transactions', query, params),ids,- // eslint-disable-next-line rulesdir/typography+ // eslint-disable-next-line actual/typographyid => `id = '${id}'`,where => `SELECT * FROM v_transactions_internal WHERE ${where}`,);diff --git a/packages/sync-server/src/app-gocardless/banks/easybank_bawaatww.js b/packages/sync-server/src/app-gocardless/banks/easybank_bawaatww.jsindex 29d7ef3048..24c981ae09 100644--- a/packages/sync-server/src/app-gocardless/banks/easybank_bawaatww.js+++ b/packages/sync-server/src/app-gocardless/banks/easybank_bawaatww.js@@ -1,5 +1,3 @@-import * as d from 'date-fns';-import { formatPayeeName } from '../../util/payee-name.js';import { title } from '../../util/title/index.js';diff --git a/packages/sync-server/src/app-gocardless/banks/fortuneo_ftnofrp1xxx.js b/packages/sync-server/src/app-gocardless/banks/fortuneo_ftnofrp1xxx.jsindex b84452ec7c..dadae97515 100644--- a/packages/sync-server/src/app-gocardless/banks/fortuneo_ftnofrp1xxx.js+++ b/packages/sync-server/src/app-gocardless/banks/fortuneo_ftnofrp1xxx.js@@ -1,5 +1,3 @@-import { formatPayeeName } from '../../util/payee-name.js';-import Fallback from './integration-bank.js';/** @type {import('./bank.interface.js').IBank} */diff --git a/upcoming-release-notes/5212.md b/upcoming-release-notes/5212.mdnew file mode 100644index 0000000000..0cf0135a7e--- /dev/null+++ b/upcoming-release-notes/5212.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [matt-fidd]+---++Introduce linting rules to improve translation consistency and coveragediff --git a/yarn.lock b/yarn.lockindex 84b2608e07..d1c73c7d44 100644--- a/yarn.lock+++ b/yarn.lock@@ -7623,7 +7623,6 @@ __metadata:eslint-plugin-jsx-a11y: "npm:^6.10.2"eslint-plugin-react: "npm:^7.37.5"eslint-plugin-react-hooks: "npm:^5.2.0"- eslint-plugin-rulesdir: "npm:^0.2.2"eslint-plugin-typescript-paths: "npm:^0.0.33"globals: "npm:^15.15.0"html-to-image: "npm:^1.11.13"@@ -10959,13 +10958,6 @@ __metadata:languageName: nodelinkType: hard-"eslint-plugin-rulesdir@npm:^0.2.2":- version: 0.2.2- resolution: "eslint-plugin-rulesdir@npm:0.2.2"- checksum: 10/aac282554e5eb5b1fb3944dd43a08be5fd3e0bc33a00738f525df08344bc1d54f4abe3303118582d86776b3146ddb9e09d3fd1af502d484b3354da2bfee2ce24- languageName: node- linkType: hard-"eslint-plugin-typescript-paths@npm:^0.0.33":version: 0.0.33resolution: "eslint-plugin-typescript-paths@npm:0.0.33"