Skip to content

A local-first personal finance app

[WIP] 🌍 Mark more files for translation (#5209)

Matt Fiddaman9952412e1d5b
diff --git a/packages/desktop-client/src/components/CommandBar.tsx b/packages/desktop-client/src/components/CommandBar.tsx
index b98f924a01..02291e06c5 100644
--- a/packages/desktop-client/src/components/CommandBar.tsx
+++ b/packages/desktop-client/src/components/CommandBar.tsx
@@ -6,7 +6,7 @@ import {
useMemo,
useState,
} from 'react';
-import { useTranslation } from 'react-i18next';
+import { Trans, useTranslation } from 'react-i18next';
import {
SvgCog,
@@ -269,7 +269,7 @@ export function CommandBar() {
color: 'var(--color-pageTextSubdued)',
})}
>
- {t('No results found')}
+ <Trans>No results found</Trans>
</Command.Empty>
)}
</Command.List>
diff --git a/packages/desktop-client/src/components/ManageRules.tsx b/packages/desktop-client/src/components/ManageRules.tsx
index e5b97c0c66..21d2462eaa 100644
--- a/packages/desktop-client/src/components/ManageRules.tsx
+++ b/packages/desktop-client/src/components/ManageRules.tsx
@@ -7,7 +7,7 @@ import React, {
type SetStateAction,
type Dispatch,
} from 'react';
-import { useTranslation } from 'react-i18next';
+import { Trans, useTranslation } from 'react-i18next';
import { Button } from '@actual-app/components/button';
import { Stack } from '@actual-app/components/stack';
@@ -114,6 +114,8 @@ export function ManageRules({
payeeId,
setLoading = () => {},
}: ManageRulesProps) {
+ const { t } = useTranslation();
+
const [allRules, setAllRules] = useState<RuleEntity[]>([]);
const [page, setPage] = useState(0);
const [filter, setFilter] = useState('');
@@ -210,7 +212,7 @@ export function ManageRules({
if (someDeletionsFailed) {
alert(
- t('Some rules were not deleted because they are linked to schedules'),
+ t('Some rules were not deleted because they are linked to schedules.'),
);
}
@@ -284,7 +286,6 @@ export function ManageRules({
const onHover = useCallback(id => {
setHoveredRule(id);
}, []);
- const { t } = useTranslation();
return (
<SelectedProvider instance={selectedInst}>
@@ -306,13 +307,15 @@ export function ManageRules({
}}
>
<Text>
- {t('Rules are always run in the order that you see them.')}{' '}
+ <Trans>
+ Rules are always run in the order that you see them.
+ </Trans>{' '}
<Link
variant="external"
to="https://actualbudget.org/docs/budgeting/rules/"
linkColor="muted"
>
- {t('Learn more')}
+ <Trans>Learn more</Trans>
</Link>
</Text>
</View>
@@ -351,11 +354,13 @@ export function ManageRules({
<Stack direction="row" align="center" justify="flex-end" spacing={2}>
{selectedInst.items.size > 0 && (
<Button onPress={onDeleteSelected}>
- Delete {selectedInst.items.size} rules
+ <Trans count={selectedInst.items.size}>
+ Delete {{ count: selectedInst.items.size }} rules
+ </Trans>
</Button>
)}
<Button variant="primary" onPress={onCreateRule}>
- {t('Create new rule')}
+ <Trans>Create new rule</Trans>
</Button>
</Stack>
</View>
diff --git a/packages/desktop-client/src/components/UpdateNotification.tsx b/packages/desktop-client/src/components/UpdateNotification.tsx
index 9290bc1d96..7be0f2ba8c 100644
--- a/packages/desktop-client/src/components/UpdateNotification.tsx
+++ b/packages/desktop-client/src/components/UpdateNotification.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 { SvgClose } from '@actual-app/components/icons/v1';
@@ -45,7 +45,7 @@ export function UpdateNotification() {
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<View style={{ marginRight: 10, fontWeight: 700 }}>
<Text>
- {t('App updated to {{version}}', { version: updateInfo.version })}
+ <Trans>App updated to {{ version: updateInfo.version }}</Trans>
</Text>
</View>
<View style={{ flex: 1 }} />
@@ -59,7 +59,7 @@ export function UpdateNotification() {
textDecoration: 'underline',
}}
>
- {t('Restart')}
+ <Trans>Restart</Trans>
</Link>{' '}
(
<Link
@@ -74,7 +74,7 @@ export function UpdateNotification() {
)
}
>
- {t('notes')}
+ <Trans>notes</Trans>
</Link>
)
<Button
diff --git a/packages/desktop-client/src/components/admin/UserAccess/UserAccess.tsx b/packages/desktop-client/src/components/admin/UserAccess/UserAccess.tsx
index bbd63f4106..5f15d3d19b 100644
--- a/packages/desktop-client/src/components/admin/UserAccess/UserAccess.tsx
+++ b/packages/desktop-client/src/components/admin/UserAccess/UserAccess.tsx
@@ -274,13 +274,14 @@ type LockToggleProps = {
function LockToggle({ style, onToggleSave }: LockToggleProps) {
const [hover, setHover] = useState(false);
const dispatch = useDispatch();
+ const { t } = useTranslation();
return (
<Button
onHoverStart={() => setHover(true)}
onHoverEnd={() => setHover(false)}
variant="primary"
- aria-label="Menu"
+ aria-label={t('Menu')}
onPress={() =>
dispatch(
pushModal({
diff --git a/packages/desktop-client/src/components/budget/goals/BudgetAutomationEditor.tsx b/packages/desktop-client/src/components/budget/goals/BudgetAutomationEditor.tsx
index 00ecd769df..67d4860ddf 100644
--- a/packages/desktop-client/src/components/budget/goals/BudgetAutomationEditor.tsx
+++ b/packages/desktop-client/src/components/budget/goals/BudgetAutomationEditor.tsx
@@ -136,7 +136,7 @@ export function BudgetAutomationEditor({
<Select
id="type-field"
options={displayTemplateTypes}
- defaultLabel="Select an option"
+ defaultLabel={t('Select an option')}
value={state.displayType}
onChange={type => type && dispatch(setType(type))}
style={{ width: 172 }}
diff --git a/packages/desktop-client/src/components/budget/goals/CategoryAutomationButton.tsx b/packages/desktop-client/src/components/budget/goals/CategoryAutomationButton.tsx
index 68db28de5d..078fefb23d 100644
--- a/packages/desktop-client/src/components/budget/goals/CategoryAutomationButton.tsx
+++ b/packages/desktop-client/src/components/budget/goals/CategoryAutomationButton.tsx
@@ -1,4 +1,5 @@
import React, { type CSSProperties } from 'react';
+import { useTranslation } from 'react-i18next';
import { Button } from '@actual-app/components/button';
import { SvgChartPie } from '@actual-app/components/icons/v1';
@@ -22,6 +23,8 @@ export function CategoryAutomationButton({
defaultColor = theme.buttonNormalText,
style,
}: CategoryAutomationButtonProps) {
+ const { t } = useTranslation();
+
const automations: Template[] = [];
const hasAutomations = !!automations.length;
@@ -37,7 +40,7 @@ export function CategoryAutomationButton({
return (
<Button
variant="bare"
- aria-label="Change category automations"
+ aria-label={t('Change category automations')}
className={!hasAutomations ? 'hover-visible' : ''}
style={{
color: defaultColor,
diff --git a/packages/desktop-client/src/components/budget/goals/editor/ScheduleAutomation.tsx b/packages/desktop-client/src/components/budget/goals/editor/ScheduleAutomation.tsx
index fd4336df2e..9309dc5d19 100644
--- a/packages/desktop-client/src/components/budget/goals/editor/ScheduleAutomation.tsx
+++ b/packages/desktop-client/src/components/budget/goals/editor/ScheduleAutomation.tsx
@@ -39,7 +39,7 @@ export const ScheduleAutomation = ({
<Select
id="schedule-field"
key="schedule-picker"
- defaultLabel="Select a schedule"
+ defaultLabel={t('Select a schedule')}
value={template.name}
onChange={schedule =>
dispatch(
diff --git a/packages/desktop-client/src/components/gocardless/GoCardlessLink.tsx b/packages/desktop-client/src/components/gocardless/GoCardlessLink.tsx
index 11150900c8..6395a5ab98 100644
--- a/packages/desktop-client/src/components/gocardless/GoCardlessLink.tsx
+++ b/packages/desktop-client/src/components/gocardless/GoCardlessLink.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { Trans } from 'react-i18next';
+import { Trans, useTranslation } from 'react-i18next';
import { Paragraph } from '@actual-app/components/paragraph';
import { View } from '@actual-app/components/view';
@@ -7,10 +7,12 @@ import { View } from '@actual-app/components/view';
import { Modal, ModalHeader } from '@desktop-client/components/common/Modal';
export function GoCardlessLink() {
+ const { t } = useTranslation();
+
window.close();
return (
<Modal name="gocardless-link" isDismissable={false}>
- <ModalHeader title="Account sync" />
+ <ModalHeader title={t('Account sync')} />
<View style={{ maxWidth: 500 }}>
<Paragraph>
<Trans>Please wait...</Trans>
diff --git a/packages/desktop-client/src/components/manager/BudgetFileSelection.tsx b/packages/desktop-client/src/components/manager/BudgetFileSelection.tsx
index 0ae34b9fb6..82cec47836 100644
--- a/packages/desktop-client/src/components/manager/BudgetFileSelection.tsx
+++ b/packages/desktop-client/src/components/manager/BudgetFileSelection.tsx
@@ -129,6 +129,8 @@ function BudgetFileMenuButton({
onDelete,
onDuplicate,
}: BudgetFileMenuButtonProps) {
+ const { t } = useTranslation();
+
const triggerRef = useRef(null);
const [menuOpen, setMenuOpen] = useState(false);
@@ -137,7 +139,7 @@ function BudgetFileMenuButton({
<Button
ref={triggerRef}
variant="bare"
- aria-label="Menu"
+ aria-label={t('Menu')}
onPress={() => {
setMenuOpen(true);
}}
@@ -182,18 +184,18 @@ function BudgetFileState({ file, currentUserId }: BudgetFileStateProps) {
return 'Server';
}
- return userFound?.displayName ?? userFound?.userName ?? 'Unassigned';
+ return userFound?.displayName ?? userFound?.userName ?? t('Unassigned');
}
- return 'Unknown';
- }, [file]);
+ return t('Unknown');
+ }, [file, t]);
switch (file.state) {
case 'unknown':
Icon = SvgCloudUnknown;
status = t('Network unavailable');
color = theme.buttonNormalDisabledText;
- ownerName = 'Unknown';
+ ownerName = t('Unknown');
break;
case 'remote':
Icon = SvgCloudDownload;
@@ -202,14 +204,14 @@ function BudgetFileState({ file, currentUserId }: BudgetFileStateProps) {
break;
case 'local':
Icon = SvgFileDouble;
- status = 'Local';
- ownerName = 'You';
+ status = t('Local');
+ ownerName = t('You');
break;
case 'broken':
ownerName = 'unknown';
Icon = SvgFileDouble;
status = t('Local');
- ownerName = 'You';
+ ownerName = t('You');
break;
default:
Icon = SvgCloudCheck;
@@ -444,6 +446,8 @@ type RefreshButtonProps = {
};
function RefreshButton({ style, onRefresh }: RefreshButtonProps) {
+ const { t } = useTranslation();
+
const [loading, setLoading] = useState(false);
async function _onRefresh() {
@@ -457,7 +461,7 @@ function RefreshButton({ style, onRefresh }: RefreshButtonProps) {
return (
<Button
variant="bare"
- aria-label="Refresh"
+ aria-label={t('Refresh')}
style={{ padding: 10, ...style }}
onPress={_onRefresh}
>
@@ -724,6 +728,8 @@ type UserAccessForFileProps = {
};
function UserAccessForFile({ fileId, currentUserId }: UserAccessForFileProps) {
+ const { t } = useTranslation();
+
const allFiles = useSelector(state => state.budgets.allFiles || []);
const remoteFiles = allFiles.filter(
f => f.state === 'remote' || f.state === 'synced' || f.state === 'detached',
@@ -736,9 +742,9 @@ function UserAccessForFile({ fileId, currentUserId }: UserAccessForFileProps) {
const sortedUsersAccess = [...usersAccess].sort((a, b) => {
const textA =
- a.userId === currentUserId ? 'You' : (a.displayName ?? a.userName);
+ a.userId === currentUserId ? t('You') : (a.displayName ?? a.userName);
const textB =
- b.userId === currentUserId ? 'You' : (b.displayName ?? b.userName);
+ b.userId === currentUserId ? t('You') : (b.displayName ?? b.userName);
return textA.localeCompare(textB);
});
@@ -794,7 +800,7 @@ function UserAccessForFile({ fileId, currentUserId }: UserAccessForFileProps) {
}}
>
{user.userId === currentUserId
- ? 'You'
+ ? t('You')
: (user.displayName ?? user.userName)}
</View>
</View>
diff --git a/packages/desktop-client/src/components/manager/ConfigServer.tsx b/packages/desktop-client/src/components/manager/ConfigServer.tsx
index f72d422871..7f2b0c152a 100644
--- a/packages/desktop-client/src/components/manager/ConfigServer.tsx
+++ b/packages/desktop-client/src/components/manager/ConfigServer.tsx
@@ -61,7 +61,7 @@ export function ElectronServerConfig({
electronServerPort <= 0 ||
electronServerPort > 65535
) {
- setConfigError('Ports must be within range 1 - 65535');
+ setConfigError(t('Ports must be within range 1 - 65535'));
return;
}
@@ -89,7 +89,7 @@ export function ElectronServerConfig({
navigate('/');
} catch (error) {
setStartingSyncServer(false);
- setConfigError('Failed to configure sync server');
+ setConfigError(t('Failed to configure sync server'));
console.error('Failed to configure sync server:', error);
}
};
@@ -481,7 +481,7 @@ export function ConfigServer() {
style={{ fontSize: 15 }}
onPress={onSubmit}
>
- {t('OK')}
+ <Trans>OK</Trans>
</ButtonWithLoading>
{currentUrl && (
<Button
@@ -489,7 +489,7 @@ export function ConfigServer() {
style={{ fontSize: 15, marginLeft: 10 }}
onPress={() => navigate(-1)}
>
- {t('Cancel')}
+ <Trans>Cancel</Trans>
</Button>
)}
</View>
@@ -507,7 +507,7 @@ export function ConfigServer() {
style={{ color: theme.pageTextLight }}
onPress={onSkip}
>
- {t('Stop using a server')}
+ <Trans>Stop using a server</Trans>
</Button>
) : (
<>
@@ -521,7 +521,7 @@ export function ConfigServer() {
}}
onPress={onSameDomain}
>
- {t('Use current domain')}
+ <Trans>Use current domain</Trans>
</Button>
)}
<Button
@@ -529,7 +529,7 @@ export function ConfigServer() {
style={{ color: theme.pageTextLight, margin: 5 }}
onPress={onSkip}
>
- {t('Don’t use a server')}
+ <Trans>Don’t use a server</Trans>
</Button>
{isNonProductionEnvironment() && (
@@ -541,7 +541,7 @@ export function ConfigServer() {
navigate('/');
}}
>
- {t('Create test file')}
+ <Trans>Create test file</Trans>
</Button>
)}
</>
diff --git a/packages/desktop-client/src/components/manager/WelcomeScreen.tsx b/packages/desktop-client/src/components/manager/WelcomeScreen.tsx
index 48ccc9c2d0..7c58dabcd6 100644
--- a/packages/desktop-client/src/components/manager/WelcomeScreen.tsx
+++ b/packages/desktop-client/src/components/manager/WelcomeScreen.tsx
@@ -84,7 +84,7 @@ export function WelcomeScreen() {
<Button
onPress={() => dispatch(pushModal({ modal: { name: 'import' } }))}
>
- {t('Import my budget')}
+ <Trans>Import my budget</Trans>
</Button>
<View
style={{
@@ -94,14 +94,14 @@ export function WelcomeScreen() {
}}
>
<Button onPress={() => dispatch(createBudget({ testMode: true }))}>
- {t('View demo')}
+ <Trans>View demo</Trans>
</Button>
<Button
variant="primary"
autoFocus
onPress={() => dispatch(createBudget({}))}
>
- {t('Start fresh')}
+ <Trans>Start fresh</Trans>
</Button>
</View>
</View>
diff --git a/packages/desktop-client/src/components/manager/subscribe/ChangePassword.tsx b/packages/desktop-client/src/components/manager/subscribe/ChangePassword.tsx
index 1f73499595..b31aa10a2a 100644
--- a/packages/desktop-client/src/components/manager/subscribe/ChangePassword.tsx
+++ b/packages/desktop-client/src/components/manager/subscribe/ChangePassword.tsx
@@ -24,13 +24,13 @@ export function ChangePassword() {
function getErrorMessage(error) {
switch (error) {
case 'invalid-password':
- return 'Password cannot be empty';
+ return t('Password cannot be empty');
case 'password-match':
- return 'Passwords do not match';
+ return t('Passwords do not match');
case 'network-failure':
- return 'Unable to contact the server';
+ return t('Unable to contact the server');
default:
- return 'Internal error';
+ return t('Internal error');
}
}
diff --git a/packages/desktop-client/src/components/mobile/accounts/Account.tsx b/packages/desktop-client/src/components/mobile/accounts/Account.tsx
index 350bcfbfca..dd09a5364d 100644
--- a/packages/desktop-client/src/components/mobile/accounts/Account.tsx
+++ b/packages/desktop-client/src/components/mobile/accounts/Account.tsx
@@ -1,4 +1,5 @@
import React from 'react';
+import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router';
import { AccountTransactions } from './AccountTransactions';
@@ -7,6 +8,7 @@ import { useAccount } from '@desktop-client/hooks/useAccount';
import { useSyncedPref } from '@desktop-client/hooks/useSyncedPref';
export function Account() {
+ const { t } = useTranslation();
const [_numberFormat] = useSyncedPref('numberFormat');
const numberFormat = _numberFormat || 'comma-dot';
const [hideFraction] = useSyncedPref('hideFraction');
@@ -15,6 +17,21 @@ export function Account() {
const account = useAccount(accountId!);
+ function accountNameFromId(id: string | undefined) {
+ switch (id) {
+ case 'onbudget':
+ return t('On Budget Accounts');
+ case 'offbudget':
+ return t('Off Budget Accounts');
+ case 'uncategorized':
+ return t('Uncategorized');
+ case 'closed':
+ return t('Closed Accounts');
+ default:
+ return t('All Accounts');
+ }
+ }
+
return (
<AccountTransactions
// This key forces the whole table rerender when the number
@@ -26,18 +43,3 @@ export function Account() {
/>
);
}
-
-function accountNameFromId(id: string | undefined) {
- switch (id) {
- case 'onbudget':
- return 'On Budget Accounts';
- case 'offbudget':
- return 'Off Budget Accounts';
- case 'uncategorized':
- return 'Uncategorized';
- case 'closed':
- return 'Closed Accounts';
- default:
- return 'All Accounts';
- }
-}
diff --git a/packages/desktop-client/src/components/mobile/budget/BudgetTable.jsx b/packages/desktop-client/src/components/mobile/budget/BudgetTable.jsx
index 4056dc37f9..e7a4e81f85 100644
--- a/packages/desktop-client/src/components/mobile/budget/BudgetTable.jsx
+++ b/packages/desktop-client/src/components/mobile/budget/BudgetTable.jsx
@@ -171,7 +171,7 @@ function Saved({ projected, onPress, show3Columns }) {
minFontSizePx={6}
maxFontSizePx={12}
mode="oneline"
- title="Projected savings"
+ title={t('Projected savings')}
style={{
color: theme.formInputText,
textAlign: 'left',
diff --git a/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx b/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx
index beb97abd83..4fd4e41ff2 100644
--- a/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx
+++ b/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx
@@ -137,6 +137,8 @@ export function lookupName(items, id) {
}
export function Status({ status, isSplit }) {
+ const { t } = useTranslation();
+
let color;
switch (status) {
@@ -161,7 +163,9 @@ export function Status({ status, isSplit }) {
textAlign: 'left',
}}
>
- {titleFirst(status) + (isSplit ? ' (Split)' : '')}
+ {isSplit
+ ? t('{{status}} (Split)', { status: titleFirst(status) })
+ : titleFirst(status)}
</Text>
);
}
@@ -451,7 +455,7 @@ const ChildTransactionEdit = forwardRef(
userSelect: 'none',
}}
>
- {t('Delete split')}
+ <Trans>Delete split</Trans>
</Text>
</Button>
</View>
@@ -962,7 +966,7 @@ const TransactionEditInner = memo(function TransactionEditInner({
color: theme.formLabelText,
}}
>
- {t('Split')}
+ <Trans>Split</Trans>
</Text>
</Button>
</View>
@@ -1065,7 +1069,7 @@ const TransactionEditInner = memo(function TransactionEditInner({
userSelect: 'none',
}}
>
- {t('Delete transaction')}
+ <Trans>Delete transaction</Trans>
</Text>
</Button>
</View>
diff --git a/packages/desktop-client/src/components/mobile/transactions/TransactionList.tsx b/packages/desktop-client/src/components/mobile/transactions/TransactionList.tsx
index 61ae659cd6..1a4bbf1a4d 100644
--- a/packages/desktop-client/src/components/mobile/transactions/TransactionList.tsx
+++ b/packages/desktop-client/src/components/mobile/transactions/TransactionList.tsx
@@ -64,9 +64,10 @@ type LoadingProps = {
};
function Loading({ style, 'aria-label': ariaLabel }: LoadingProps) {
+ const { t } = useTranslation();
return (
<View
- aria-label={ariaLabel || 'Loading...'}
+ aria-label={ariaLabel || t('Loading...')}
style={{
backgroundColor: theme.mobilePageBackground,
flex: 1,
diff --git a/packages/desktop-client/src/components/modals/AccountMenuModal.tsx b/packages/desktop-client/src/components/modals/AccountMenuModal.tsx
index 000b89c38a..303bdec63a 100644
--- a/packages/desktop-client/src/components/modals/AccountMenuModal.tsx
+++ b/packages/desktop-client/src/components/modals/AccountMenuModal.tsx
@@ -208,6 +208,7 @@ function AdditionalAccountMenu({
onClose,
onReopen,
}: AdditionalAccountMenuProps) {
+ const { t } = useTranslation();
const triggerRef = useRef(null);
const [menuOpen, setMenuOpen] = useState(false);
const itemStyle: CSSProperties = {
@@ -225,7 +226,7 @@ function AdditionalAccountMenu({
<Button
ref={triggerRef}
variant="bare"
- aria-label="Menu"
+ aria-label={t('Menu')}
onPress={() => {
setMenuOpen(true);
}}
@@ -247,13 +248,13 @@ function AdditionalAccountMenu({
account.closed
? {
name: 'reopen',
- text: 'Reopen account',
+ text: t('Reopen account'),
icon: SvgLockOpen,
iconSize: 15,
}
: {
name: 'close',
- text: 'Close account',
+ text: t('Close account'),
icon: SvgClose,
iconSize: 15,
},
diff --git a/packages/desktop-client/src/components/modals/EditRuleModal.jsx b/packages/desktop-client/src/components/modals/EditRuleModal.jsx
index 38210b6b42..85b9571aac 100644
--- a/packages/desktop-client/src/components/modals/EditRuleModal.jsx
+++ b/packages/desktop-client/src/components/modals/EditRuleModal.jsx
@@ -173,6 +173,7 @@ function SplitAmountMethodSelect({ options, style, value, onChange }) {
}
function EditorButtons({ onAdd, onDelete }) {
+ const { t } = useTranslation();
return (
<>
{onDelete && (
@@ -180,7 +181,7 @@ function EditorButtons({ onAdd, onDelete }) {
variant="bare"
onPress={onDelete}
style={{ padding: 7 }}
- aria-label="Delete entry"
+ aria-label={t('Delete entry')}
>
<SvgSubtract style={{ width: 8, height: 8, color: 'inherit' }} />
</Button>
@@ -190,7 +191,7 @@ function EditorButtons({ onAdd, onDelete }) {
variant="bare"
onPress={onAdd}
style={{ padding: 7 }}
- aria-label="Add entry"
+ aria-label={t('Add entry')}
>
<SvgAdd style={{ width: 10, height: 10, color: 'inherit' }} />
</Button>
diff --git a/packages/desktop-client/src/components/modals/EditUser.tsx b/packages/desktop-client/src/components/modals/EditUser.tsx
index 13135fcf21..e0bfb197cf 100644
--- a/packages/desktop-client/src/components/modals/EditUser.tsx
+++ b/packages/desktop-client/src/components/modals/EditUser.tsx
@@ -143,7 +143,7 @@ export function EditUserFinanceApp({
? t('Edit user {{userName}}', {
userName: defaultUser.displayName ?? defaultUser.userName,
})
- : 'Add user'
+ : t('Add user')
}
rightContent={<ModalCloseButton onPress={close} />}
/>
@@ -249,7 +249,7 @@ function EditUser({ defaultUser, onSave: originalOnSave }: EditUserProps) {
onChange={() => setEnabled(!enabled)}
/>
<label htmlFor="enabled-field" style={{ userSelect: 'none' }}>
- Enabled
+ <Trans>Enabled</Trans>
</label>
</View>
</Stack>
@@ -305,7 +305,7 @@ function EditUser({ defaultUser, onSave: originalOnSave }: EditUserProps) {
</Stack>
<Stack direction="row" style={{ marginTop: 10, width: '100px' }}>
<FormField style={{ flex: 1 }}>
- <FormLabel title="Role" htmlFor="role-field" />
+ <FormLabel title={t('Role')} htmlFor="role-field" />
<Select
id="role-field"
disabled={isOwner}
@@ -335,7 +335,7 @@ function EditUser({ defaultUser, onSave: originalOnSave }: EditUserProps) {
<Trans>Cancel</Trans>
</Button>
<Button variant="primary" onPress={onSave}>
- {isExistingUser ? 'Save' : 'Add'}
+ {isExistingUser ? t('Save') : t('Add')}
</Button>
</Stack>
</>
diff --git a/packages/desktop-client/src/components/modals/ImportTransactionsModal/DateFormatSelect.tsx b/packages/desktop-client/src/components/modals/ImportTransactionsModal/DateFormatSelect.tsx
index 4fb450d47e..1752463578 100644
--- a/packages/desktop-client/src/components/modals/ImportTransactionsModal/DateFormatSelect.tsx
+++ b/packages/desktop-client/src/components/modals/ImportTransactionsModal/DateFormatSelect.tsx
@@ -1,4 +1,5 @@
import React from 'react';
+import { useTranslation } from 'react-i18next';
import { Select } from '@actual-app/components/select';
import { View } from '@actual-app/components/view';
@@ -24,6 +25,7 @@ export function DateFormatSelect({
parseDateFormat,
onChange,
}: DateFormatSelectProps) {
+ const { t } = useTranslation();
// We don't actually care about the delimiter, but we try to render
// it based on the data we have so far. Look in a transaction and
// try to figure out what delimiter the date is using, and default
@@ -37,7 +39,7 @@ export function DateFormatSelect({
return (
<View style={{ width: 120 }}>
- <SectionLabel title="Date format" />
+ <SectionLabel title={t('Date format')} />
<Select
options={dateFormats.map(f => [
f.format,
diff --git a/packages/desktop-client/src/components/modals/ImportTransactionsModal/FieldMappings.tsx b/packages/desktop-client/src/components/modals/ImportTransactionsModal/FieldMappings.tsx
index 9497099dc7..4370ea9040 100644
--- a/packages/desktop-client/src/components/modals/ImportTransactionsModal/FieldMappings.tsx
+++ b/packages/desktop-client/src/components/modals/ImportTransactionsModal/FieldMappings.tsx
@@ -1,4 +1,5 @@
import React from 'react';
+import { useTranslation } from 'react-i18next';
import { Stack } from '@actual-app/components/stack';
import { View } from '@actual-app/components/view';
@@ -39,6 +40,7 @@ export function FieldMappings({
inOutMode,
hasHeaderRow,
}: FieldMappingsProps) {
+ const { t } = useTranslation();
if (transactions.length === 0) {
return null;
}
@@ -48,7 +50,7 @@ export function FieldMappings({
return (
<View>
- <SectionLabel title="CSV FIELDS" />
+ <SectionLabel title={t('CSV FIELDS')} />
<Stack
direction="row"
align="flex-start"
@@ -56,7 +58,7 @@ export function FieldMappings({
style={{ marginTop: 5 }}
>
<View style={{ flex: 1, marginRight: 10 }}>
- <SubLabel title="Date" />
+ <SubLabel title={t('Date')} />
<SelectField
options={options}
value={mappings.date}
@@ -66,7 +68,7 @@ export function FieldMappings({
/>
</View>
<View style={{ flex: 1, marginRight: 10 }}>
- <SubLabel title="Payee" />
+ <SubLabel title={t('Payee')} />
<SelectField
options={options}
value={mappings.payee}
@@ -76,7 +78,7 @@ export function FieldMappings({
/>
</View>
<View style={{ flex: 1, marginRight: 10 }}>
- <SubLabel title="Notes" />
+ <SubLabel title={t('Notes')} />
<SelectField
options={options}
value={mappings.notes}
@@ -86,7 +88,7 @@ export function FieldMappings({
/>
</View>
<View style={{ flex: 1, marginRight: 10 }}>
- <SubLabel title="Category" />
+ <SubLabel title={t('Category')} />
<SelectField
options={options}
value={mappings.category}
@@ -98,7 +100,7 @@ export function FieldMappings({
{splitMode && !inOutMode ? (
<>
<View style={{ flex: 0.5 }}>
- <SubLabel title="Outflow" />
+ <SubLabel title={t('Outflow')} />
<SelectField
options={options}
value={mappings.outflow}
@@ -108,7 +110,7 @@ export function FieldMappings({
/>
</View>
<View style={{ flex: 0.5 }}>
- <SubLabel title="Inflow" />
+ <SubLabel title={t('Inflow')} />
<SelectField
options={options}
value={mappings.inflow}
@@ -122,7 +124,7 @@ export function FieldMappings({
<>
{inOutMode && (
<View style={{ flex: 1 }}>
- <SubLabel title="In/Out" />
+ <SubLabel title={t('In/Out')} />
<SelectField
options={options}
value={mappings.inOut}
@@ -133,7 +135,7 @@ export function FieldMappings({
</View>
)}
<View style={{ flex: 1 }}>
- <SubLabel title="Amount" />
+ <SubLabel title={t('Amount')} />
<SelectField
options={options}
value={mappings.amount}
diff --git a/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.jsx b/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.jsx
index ffd2e7cf96..e21203b4f6 100644
--- a/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.jsx
+++ b/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.jsx
@@ -577,9 +577,10 @@ export function ImportTransactionsModal({
? trans.date
: parseDate(trans.date, parseDateFormat);
if (date == null) {
- errorMessage = `Unable to parse date ${
- trans.date || '(empty)'
- } with given date format`;
+ errorMessage = t(
+ 'Unable to parse date {{date}} with given date format',
+ { date: trans.date || '(empty)' },
+ );
break;
}
@@ -592,7 +593,9 @@ export function ImportTransactionsModal({
multiplierAmount,
);
if (amount == null) {
- errorMessage = `Transaction on ${trans.date} has no amount`;
+ errorMessage = t('Transaction on {{date}} has no amount', {
+ date: trans.date,
+ });
break;
}
@@ -725,13 +728,29 @@ export function ImportTransactionsModal({
headers.unshift({ name: ' ', width: 31 });
}
if (inOutMode) {
- headers.push({ name: 'In/Out', width: 90, style: { textAlign: 'left' } });
+ headers.push({
+ name: t('In/Out'),
+ width: 90,
+ style: { textAlign: 'left' },
+ });
}
if (splitMode) {
- headers.push({ name: 'Outflow', width: 90, style: { textAlign: 'right' } });
- headers.push({ name: 'Inflow', width: 90, style: { textAlign: 'right' } });
+ headers.push({
+ name: t('Outflow'),
+ width: 90,
+ style: { textAlign: 'right' },
+ });
+ headers.push({
+ name: t('Inflow'),
+ width: 90,
+ style: { textAlign: 'right' },
+ });
} else {
- headers.push({ name: 'Amount', width: 90, style: { textAlign: 'right' } });
+ headers.push({
+ name: t('Amount'),
+ width: 90,
+ style: { textAlign: 'right' },
+ });
}
return (
@@ -752,7 +771,10 @@ export function ImportTransactionsModal({
{error && !error.parsed && (
<View style={{ alignItems: 'center', marginBottom: 15 }}>
<Text style={{ marginRight: 10, color: theme.errorText }}>
- <strong>Error:</strong> {error.message}
+ <strong>
+ <Trans>Error:</Trans>
+ </strong>{' '}
+ {error.message}
</Text>
</View>
)}
@@ -824,7 +846,7 @@ export function ImportTransactionsModal({
</Text>
{error.parsed && (
<Button onPress={() => onNewFile()}>
- {t('Select new file...')}
+ <Trans>Select new file...</Trans>
</Button>
)}
</View>
@@ -858,7 +880,7 @@ export function ImportTransactionsModal({
);
}}
>
- {t('Use Memo as a fallback for empty Payees')}
+ <Trans>Use Memo as a fallback for empty Payees</Trans>
</CheckboxOption>
)}
@@ -1000,7 +1022,7 @@ export function ImportTransactionsModal({
);
}}
>
- {t('File has header row')}
+ <Trans>File has header row</Trans>
</CheckboxOption>
<CheckboxOption
id="clear_on_import"
@@ -1009,7 +1031,7 @@ export function ImportTransactionsModal({
setClearOnImport(!clearOnImport);
}}
>
- {t('Clear transactions on import')}
+ <Trans>Clear transactions on import</Trans>
</CheckboxOption>
<CheckboxOption
id="form_dont_reconcile"
@@ -1018,7 +1040,7 @@ export function ImportTransactionsModal({
setReconcile(!reconcile);
}}
>
- {t('Merge with existing transactions')}
+ <Trans>Merge with existing transactions</Trans>
</CheckboxOption>
</View>
)}
@@ -1035,7 +1057,7 @@ export function ImportTransactionsModal({
runImportPreview();
}}
>
- {t('Flip amount')}
+ <Trans>Flip amount</Trans>
</CheckboxOption>
<MultiplierOption
multiplierEnabled={multiplierEnabled}
@@ -1057,7 +1079,9 @@ export function ImportTransactionsModal({
runImportPreview();
}}
>
- {t('Split amount into separate inflow/outflow columns')}
+ <Trans>
+ Split amount into separate inflow/outflow columns
+ </Trans>
</CheckboxOption>
<InOutOption
inOutMode={inOutMode}
@@ -1085,27 +1109,25 @@ export function ImportTransactionsModal({
gap: '1em',
}}
>
- <ButtonWithLoading
- variant="primary"
- autoFocus
- isDisabled={
- transactions?.filter(
- trans => !trans.isMatchedTransaction && trans.selected,
- ).length === 0
- }
- isLoading={loadingState === 'importing'}
- onPress={() => {
- onImport(close);
- }}
- >
- Import{' '}
- {
- transactions?.filter(
- trans => !trans.isMatchedTransaction && trans.selected,
- ).length
- }{' '}
- {t('transactions')}
- </ButtonWithLoading>
+ {(() => {
+ const count = transactions?.filter(
+ trans => !trans.isMatchedTransaction && trans.selected,
+ ).length;
+
+ return (
+ <ButtonWithLoading
+ variant="primary"
+ autoFocus
+ isDisabled={count === 0}
+ isLoading={loadingState === 'importing'}
+ onPress={() => {
+ onImport(close);
+ }}
+ >
+ <Trans count={count}>Import {{ count }} transactions</Trans>
+ </ButtonWithLoading>
+ );
+ })()}
</View>
</View>
</>
diff --git a/packages/desktop-client/src/components/modals/ImportTransactionsModal/MultiplierOption.tsx b/packages/desktop-client/src/components/modals/ImportTransactionsModal/MultiplierOption.tsx
index de6b74b02d..31c8a24d85 100644
--- a/packages/desktop-client/src/components/modals/ImportTransactionsModal/MultiplierOption.tsx
+++ b/packages/desktop-client/src/components/modals/ImportTransactionsModal/MultiplierOption.tsx
@@ -1,4 +1,5 @@
import React, { type ComponentProps } from 'react';
+import { Trans, useTranslation } from 'react-i18next';
import { Input } from '@actual-app/components/input';
import { View } from '@actual-app/components/view';
@@ -18,6 +19,7 @@ export function MultiplierOption({
onToggle,
onChangeAmount,
}: MultiplierOptionProps) {
+ const { t } = useTranslation();
return (
<View style={{ flexDirection: 'row', gap: 10, height: 28 }}>
<CheckboxOption
@@ -25,13 +27,13 @@ export function MultiplierOption({
checked={multiplierEnabled}
onChange={onToggle}
>
- Multiply amount
+ <Trans>Multiply amount</Trans>
</CheckboxOption>
<Input
type="text"
style={{ display: multiplierEnabled ? 'inherit' : 'none' }}
value={multiplierAmount}
- placeholder="Multiplier"
+ placeholder={t('Multiplier')}
onChangeValue={onChangeAmount}
/>
</View>
diff --git a/packages/desktop-client/src/components/modals/LoadBackupModal.tsx b/packages/desktop-client/src/components/modals/LoadBackupModal.tsx
index 5195ef371b..00cd105f1a 100644
--- a/packages/desktop-client/src/components/modals/LoadBackupModal.tsx
+++ b/packages/desktop-client/src/components/modals/LoadBackupModal.tsx
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react';
-import { useTranslation } from 'react-i18next';
+import { Trans, useTranslation } from 'react-i18next';
import { Block } from '@actual-app/components/block';
import { Button } from '@actual-app/components/button';
@@ -103,11 +103,12 @@ export function LoadBackupModal({
<Block>
<Block style={{ marginBottom: 10 }}>
<Text style={{ fontWeight: 600 }}>
- {t('You are currently working from a backup.')}
+ <Trans>You are currently working from a backup.</Trans>
</Text>{' '}
- {t(
- 'You can load a different backup or revert to the original version below.',
- )}
+ <Trans>
+ You can load a different backup or revert to the original
+ version below.
+ </Trans>
</Block>
<Button
variant="primary"
@@ -122,19 +123,22 @@ export function LoadBackupModal({
}
}}
>
- {t('Revert to original version')}
+ <Trans>Revert to original version</Trans>
</Button>
</Block>
) : (
<View style={{ alignItems: 'flex-start' }}>
<Block style={{ marginBottom: 10 }}>
- {t(
- 'Select a backup to load. After loading a backup, you will have a chance to revert to the current version in this screen.',
- )}{' '}
+ <Trans>
+ Select a backup to load. After loading a backup, you will
+ have a chance to revert to the current version in this
+ screen.
+ </Trans>{' '}
<Text style={{ fontWeight: 600 }}>
- {t(
- 'If you use a backup, you will have to set up all your devices to sync from the new budget.',
- )}
+ <Trans>
+ If you use a backup, you will have to set up all your
+ devices to sync from the new budget.
+ </Trans>
</Text>
</Block>
<Button
@@ -142,14 +146,14 @@ export function LoadBackupModal({
isDisabled={backupDisabled}
onPress={() => dispatch(makeBackup())}
>
- {t('Back up now')}
+ <Trans>Back up now</Trans>
</Button>
</View>
)}
</View>
{previousBackups.length === 0 ? (
<Block style={{ color: theme.tableTextLight, marginLeft: 20 }}>
- {t('No backups available')}
+ <Trans>No backups available</Trans>
</Block>
) : (
<BackupTable
diff --git a/packages/desktop-client/src/components/modals/manager/ImportActualModal.tsx b/packages/desktop-client/src/components/modals/manager/ImportActualModal.tsx
index 815632213d..b97c8f3347 100644
--- a/packages/desktop-client/src/components/modals/manager/ImportActualModal.tsx
+++ b/packages/desktop-client/src/components/modals/manager/ImportActualModal.tsx
@@ -18,23 +18,6 @@ import {
import { useNavigate } from '@desktop-client/hooks/useNavigate';
import { useDispatch } from '@desktop-client/redux';
-function getErrorMessage(error: string): string {
- switch (error) {
- case 'parse-error':
- return 'Unable to parse file. Please select a JSON file exported from nYNAB.';
- case 'not-ynab5':
- return 'This file is not valid. Please select a JSON file exported from nYNAB.';
- case 'not-zip-file':
- return 'This file is not valid. Please select an unencrypted archive of Actual data.';
- case 'invalid-zip-file':
- return 'This archive is not a valid Actual export file.';
- case 'invalid-metadata-file':
- return 'The metadata file in the given archive is corrupted.';
- default:
- return 'An unknown error occurred while importing. Please report this as a new issue on GitHub.';
- }
-}
-
export function ImportActualModal() {
const { t } = useTranslation();
const navigate = useNavigate();
@@ -42,6 +25,31 @@ export function ImportActualModal() {
const [error, setError] = useState<string | null>(null);
const [importing, setImporting] = useState(false);
+ function getErrorMessage(error: string): string {
+ switch (error) {
+ case 'parse-error':
+ return t(
+ 'Unable to parse file. Please select a JSON file exported from nYNAB.',
+ );
+ case 'not-ynab5':
+ return t(
+ 'This file is not valid. Please select a JSON file exported from nYNAB.',
+ );
+ case 'not-zip-file':
+ return t(
+ 'This file is not valid. Please select an unencrypted archive of Actual data.',
+ );
+ case 'invalid-zip-file':
+ return t('This archive is not a valid Actual export file.');
+ case 'invalid-metadata-file':
+ return t('The metadata file in the given archive is corrupted.');
+ default:
+ return t(
+ 'An unknown error occurred while importing. Please report this as a new issue on GitHub.',
+ );
+ }
+ }
+
async function onImport() {
const res = await window.Actual.openFileDialog({
properties: ['openFile'],
diff --git a/packages/desktop-client/src/components/modals/manager/ImportModal.tsx b/packages/desktop-client/src/components/modals/manager/ImportModal.tsx
index dee728b00b..dd2ad5786e 100644
--- a/packages/desktop-client/src/components/modals/manager/ImportModal.tsx
+++ b/packages/desktop-client/src/components/modals/manager/ImportModal.tsx
@@ -16,15 +16,6 @@ import {
import { pushModal } from '@desktop-client/modals/modalsSlice';
import { useDispatch } from '@desktop-client/redux';
-function getErrorMessage(error: 'not-ynab4' | boolean) {
- switch (error) {
- case 'not-ynab4':
- return 'This file is not valid. Please select a .ynab4 file';
- default:
- return 'An unknown error occurred while importing. Please report this as a new issue on GitHub.';
- }
-}
-
export function ImportModal() {
const { t } = useTranslation();
@@ -46,6 +37,16 @@ export function ImportModal() {
}
}
+ function getErrorMessage(error: 'not-ynab4' | boolean) {
+ switch (error) {
+ case 'not-ynab4':
+ return t('This file is not valid. Please select a .ynab4 file');
+ default:
+ return t(
+ 'An unknown error occurred while importing. Please report this as a new issue on GitHub.',
+ );
+ }
+ }
const itemStyle = {
padding: 10,
border: '1px solid ' + theme.tableBorder,
diff --git a/packages/desktop-client/src/components/modals/manager/ImportYNAB5Modal.tsx b/packages/desktop-client/src/components/modals/manager/ImportYNAB5Modal.tsx
index 4be9036357..996967c583 100644
--- a/packages/desktop-client/src/components/modals/manager/ImportYNAB5Modal.tsx
+++ b/packages/desktop-client/src/components/modals/manager/ImportYNAB5Modal.tsx
@@ -19,22 +19,29 @@ import {
import { useNavigate } from '@desktop-client/hooks/useNavigate';
import { useDispatch } from '@desktop-client/redux';
-function getErrorMessage(error: string): string {
- switch (error) {
- case 'parse-error':
- return 'Unable to parse file. Please select a JSON file exported from nYNAB.';
- case 'not-ynab5':
- return 'This file is not valid. Please select a JSON file exported from nYNAB.';
- default:
- return 'An unknown error occurred while importing. Please report this as a new issue on GitHub.';
- }
-}
-
export function ImportYNAB5Modal() {
const { t } = useTranslation();
const navigate = useNavigate();
const dispatch = useDispatch();
const [error, setError] = useState<string | null>(null);
+
+ function getErrorMessage(error: string): string {
+ switch (error) {
+ case 'parse-error':
+ return t(
+ 'Unable to parse file. Please select a JSON file exported from nYNAB.',
+ );
+ case 'not-ynab5':
+ return t(
+ 'This file is not valid. Please select a JSON file exported from nYNAB.',
+ );
+ default:
+ return t(
+ 'An unknown error occurred while importing. Please report this as a new issue on GitHub.',
+ );
+ }
+ }
+
const [importing, setImporting] = useState(false);
async function onImport() {
diff --git a/packages/desktop-client/src/components/reports/CategorySelector.tsx b/packages/desktop-client/src/components/reports/CategorySelector.tsx
index 6058a6416a..90175a7d84 100644
--- a/packages/desktop-client/src/components/reports/CategorySelector.tsx
+++ b/packages/desktop-client/src/components/reports/CategorySelector.tsx
@@ -1,6 +1,6 @@
// @ts-strict-ignore
import React, { Fragment, useMemo, useState } from 'react';
-import { useTranslation } from 'react-i18next';
+import { Trans, useTranslation } from 'react-i18next';
import { Button } from '@actual-app/components/button';
import {
@@ -87,7 +87,9 @@ export function CategorySelector({
height={15}
style={{ marginRight: 5 }}
/>
- <Text>{t('Show unchecked')}</Text>
+ <Text>
+ <Trans>Show unchecked</Trans>
+ </Text>
</View>
) : (
<View
@@ -109,7 +111,7 @@ export function CategorySelector({
textOverflow: 'ellipsis',
}}
>
- {t('Hide unchecked')}
+ <Trans>Hide unchecked</Trans>
</Text>
</View>
)}
diff --git a/packages/desktop-client/src/components/reports/Header.tsx b/packages/desktop-client/src/components/reports/Header.tsx
index e153c7ea9a..1f2c0ce520 100644
--- a/packages/desktop-client/src/components/reports/Header.tsx
+++ b/packages/desktop-client/src/components/reports/Header.tsx
@@ -1,5 +1,5 @@
import { type ComponentProps, type ReactNode } 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';
@@ -152,26 +152,26 @@ export function Header({
variant="bare"
onPress={() => onChangeDates(...getLatestRange(1))}
>
- {t('1 month')}
+ <Trans>1 month</Trans>
</Button>
)}
<Button
variant="bare"
onPress={() => onChangeDates(...getLatestRange(2))}
>
- {t('3 months')}
+ <Trans>3 months</Trans>
</Button>
<Button
variant="bare"
onPress={() => onChangeDates(...getLatestRange(5))}
>
- {t('6 months')}
+ <Trans>6 months</Trans>
</Button>
<Button
variant="bare"
onPress={() => onChangeDates(...getLatestRange(11))}
>
- {t('1 year')}
+ <Trans>1 year</Trans>
</Button>
<Button
variant="bare"
@@ -189,7 +189,7 @@ export function Header({
)
}
>
- {t('Year to date')}
+ <Trans>Year to date</Trans>
</Button>
<Button
variant="bare"
@@ -207,7 +207,7 @@ export function Header({
)
}
>
- {t('Last year')}
+ <Trans>Last year</Trans>
</Button>
<Button
variant="bare"
@@ -217,7 +217,7 @@ export function Header({
)
}
>
- {t('All time')}
+ <Trans>All time</Trans>
</Button>
{filters && (
diff --git a/packages/desktop-client/src/components/reports/Overview.tsx b/packages/desktop-client/src/components/reports/Overview.tsx
index 7342c7ad56..94d943e50b 100644
--- a/packages/desktop-client/src/components/reports/Overview.tsx
+++ b/packages/desktop-client/src/components/reports/Overview.tsx
@@ -250,7 +250,7 @@ export function Overview() {
window.Actual.saveFile(
JSON.stringify(data, null, 2),
'dashboard.json',
- 'Export Dashboard',
+ t('Export Dashboard'),
);
};
const onImport = async () => {
diff --git a/packages/desktop-client/src/components/reports/ReportSidebar.tsx b/packages/desktop-client/src/components/reports/ReportSidebar.tsx
index da28af5ef8..797887700e 100644
--- a/packages/desktop-client/src/components/reports/ReportSidebar.tsx
+++ b/packages/desktop-client/src/components/reports/ReportSidebar.tsx
@@ -1,5 +1,5 @@
import React, { useMemo, useRef, useState } from 'react';
-import { useTranslation } from 'react-i18next';
+import { Trans, useTranslation } from 'react-i18next';
import { Button } from '@actual-app/components/button';
import { Menu } from '@actual-app/components/menu';
@@ -215,7 +215,9 @@ export function ReportSidebar({
}}
>
<Text>
- <strong>{t('Display')}</strong>
+ <strong>
+ <Trans>Display</Trans>
+ </strong>
</Text>
</View>
<SpaceBetween
@@ -224,18 +226,20 @@ export function ReportSidebar({
padding: 5,
}}
>
- <Text style={{ width: 50, textAlign: 'right' }}>{t('Mode:')}</Text>
+ <Text style={{ width: 50, textAlign: 'right' }}>
+ <Trans>Mode:</Trans>
+ </Text>
<ModeButton
selected={customReportItems.mode === 'total'}
onSelect={() => onChangeMode('total')}
>
- {t('Total')}
+ <Trans>Total</Trans>
</ModeButton>
<ModeButton
selected={customReportItems.mode === 'time'}
onSelect={() => onChangeMode('time')}
>
- {t('Time')}
+ <Trans>Time</Trans>
</ModeButton>
</SpaceBetween>
@@ -247,7 +251,7 @@ export function ReportSidebar({
}}
>
<Text style={{ width: 50, textAlign: 'right', marginRight: 5 }}>
- {t('Split:')}
+ <Trans>Split:</Trans>
</Text>
<Select
value={customReportItems.groupBy}
@@ -268,7 +272,7 @@ export function ReportSidebar({
}}
>
<Text style={{ width: 50, textAlign: 'right', marginRight: 5 }}>
- {t('Type:')}
+ <Trans>Type:</Trans>
</Text>
<Select
value={customReportItems.balanceType}
@@ -288,7 +292,7 @@ export function ReportSidebar({
}}
>
<Text style={{ width: 50, textAlign: 'right', marginRight: 5 }}>
- {t('Interval:')}
+ <Trans>Interval:</Trans>
</Text>
<Select
value={customReportItems.interval}
@@ -322,7 +326,7 @@ export function ReportSidebar({
}}
>
<Text style={{ width: 50, textAlign: 'right', marginRight: 5 }}>
- {t('Sort:')}
+ <Trans>Sort:</Trans>
</Text>
<Select
value={customReportItems.sortBy}
@@ -354,7 +358,7 @@ export function ReportSidebar({
padding: '5px 10px',
}}
>
- {t('Options')}
+ <Trans>Options</Trans>
</Button>
<Popover
triggerRef={triggerRef}
@@ -455,7 +459,9 @@ export function ReportSidebar({
}}
>
<Text>
- <strong>{t('Date filters')}</strong>
+ <strong>
+ <Trans>Date filters</Trans>
+ </strong>
</Text>
<View style={{ flex: 1 }} />
<ModeButton
@@ -480,7 +486,7 @@ export function ReportSidebar({
);
}}
>
- {t('Static')}
+ <Trans>Static</Trans>
</ModeButton>
</SpaceBetween>
{!customReportItems.isDateStatic ? (
@@ -492,7 +498,7 @@ export function ReportSidebar({
}}
>
<Text style={{ width: 50, textAlign: 'right', marginRight: 5 }}>
- {t('Range:')}
+ <Trans>Range:</Trans>
</Text>
<Select
value={customReportItems.dateRange}
@@ -525,7 +531,7 @@ export function ReportSidebar({
}}
>
<Text style={{ width: 50, textAlign: 'right', marginRight: 5 }}>
- From:
+ <Trans>From:</Trans>
</Text>
<Select
onChange={newValue =>
@@ -557,7 +563,7 @@ export function ReportSidebar({
}}
>
<Text style={{ width: 50, textAlign: 'right', marginRight: 5 }}>
- To:
+ <Trans>To:</Trans>
</Text>
<Select
onChange={newValue =>
@@ -600,7 +606,9 @@ export function ReportSidebar({
>
{isComplexCategoryCondition ? (
<Information>
- {t('Remove active category filters to show the category selector.')}
+ <Trans>
+ Remove active category filters to show the category selector.
+ </Trans>
</Information>
) : (
<CategorySelector
diff --git a/packages/desktop-client/src/components/reports/ReportSummary.tsx b/packages/desktop-client/src/components/reports/ReportSummary.tsx
index 3c514e459a..e30ce2129b 100644
--- a/packages/desktop-client/src/components/reports/ReportSummary.tsx
+++ b/packages/desktop-client/src/components/reports/ReportSummary.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { useTranslation } from 'react-i18next';
+import { Trans, useTranslation } from 'react-i18next';
import { styles } from '@actual-app/components/styles';
import { Text } from '@actual-app/components/text';
@@ -43,12 +43,12 @@ export function ReportSummary({
const { t } = useTranslation();
const net =
balanceTypeOp === 'netAssets'
- ? 'DEPOSIT'
+ ? t('DEPOSIT')
: balanceTypeOp === 'netDebts'
- ? 'PAYMENT'
+ ? t('PAYMENT')
: Math.abs(data.totalDebts) > Math.abs(data.totalAssets)
- ? 'PAYMENT'
- : 'DEPOSIT';
+ ? t('PAYMENT')
+ : t('DEPOSIT');
const average = amountToInteger(data[balanceTypeOp]) / intervalsCount;
return (
<View
@@ -114,10 +114,10 @@ export function ReportSummary({
}}
>
{balanceTypeOp === 'totalDebts'
- ? 'TOTAL SPENDING'
+ ? t('TOTAL SPENDING')
: balanceTypeOp === 'totalAssets'
- ? 'TOTAL DEPOSITS'
- : 'NET ' + net}
+ ? t('TOTAL DEPOSITS')
+ : t('NET {{net}}', { net })}
</Text>
<Text
style={{
@@ -129,7 +129,9 @@ export function ReportSummary({
>
<PrivacyFilter>{amountToCurrency(data[balanceTypeOp])}</PrivacyFilter>
</Text>
- <Text style={{ fontWeight: 600 }}>{t('For this time period')}</Text>
+ <Text style={{ fontWeight: 600 }}>
+ <Trans>For this time period</Trans>
+ </Text>
</View>
<View
style={{
@@ -149,10 +151,10 @@ export function ReportSummary({
}}
>
{balanceTypeOp === 'totalDebts'
- ? 'AVERAGE SPENDING'
+ ? t('AVERAGE SPENDING')
: balanceTypeOp === 'totalAssets'
- ? 'AVERAGE DEPOSIT'
- : 'AVERAGE NET'}
+ ? t('AVERAGE DEPOSIT')
+ : t('AVERAGE NET')}
</Text>
<Text
style={{
diff --git a/packages/desktop-client/src/components/reports/SaveReportChoose.tsx b/packages/desktop-client/src/components/reports/SaveReportChoose.tsx
index 6b1a8f4bc1..57a703a88d 100644
--- a/packages/desktop-client/src/components/reports/SaveReportChoose.tsx
+++ b/packages/desktop-client/src/components/reports/SaveReportChoose.tsx
@@ -1,6 +1,6 @@
import React, { useRef, useEffect, useState } from 'react';
import { Form } from 'react-aria-components';
-import { useTranslation } from 'react-i18next';
+import { Trans } from 'react-i18next';
import { Button } from '@actual-app/components/button';
import { Stack } from '@actual-app/components/stack';
@@ -18,7 +18,6 @@ export function SaveReportChoose({ onApply }: SaveReportChooseProps) {
const inputRef = useRef<HTMLInputElement>(null);
const [err, setErr] = useState('');
const [value, setValue] = useState('');
- const { t } = useTranslation();
useEffect(() => {
if (inputRef.current) {
@@ -42,7 +41,7 @@ export function SaveReportChoose({ onApply }: SaveReportChooseProps) {
>
<View style={{ flexDirection: 'row', align: 'center' }}>
<Text style={{ userSelect: 'none', flex: 1 }}>
- {t('Choose Report')}
+ <Trans>Choose Report</Trans>
</Text>
<View style={{ flex: 1 }} />
</View>
@@ -65,7 +64,7 @@ export function SaveReportChoose({ onApply }: SaveReportChooseProps) {
>
<View style={{ flex: 1 }} />
<Button variant="primary" type="submit">
- {t('Apply')}
+ <Trans>Apply</Trans>
</Button>
</Stack>
</Form>
diff --git a/packages/desktop-client/src/components/reports/SummaryNumber.tsx b/packages/desktop-client/src/components/reports/SummaryNumber.tsx
index 45fcd3c820..8cb6cc4507 100644
--- a/packages/desktop-client/src/components/reports/SummaryNumber.tsx
+++ b/packages/desktop-client/src/components/reports/SummaryNumber.tsx
@@ -1,4 +1,5 @@
import React, { type Ref, useRef, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { View } from '@actual-app/components/view';
import { debounce } from 'debounce';
@@ -32,6 +33,7 @@ export function SummaryNumber({
initialFontSize = 14,
fontSizeChanged,
}: SummaryNumberProps) {
+ const { t } = useTranslation();
const [fontSize, setFontSize] = useState<number>(initialFontSize);
const refDiv = useRef<HTMLDivElement>(null);
const displayAmount = amountToCurrency(Math.abs(value)) + suffix;
@@ -65,7 +67,11 @@ export function SummaryNumber({
<View
ref={mergedRef as Ref<HTMLDivElement>}
role="text"
- aria-label={`${value < 0 ? 'Negative' : 'Positive'} amount: ${displayAmount}`}
+ aria-label={
+ value < 0
+ ? t('Negative amount: {{amount}}', { amount: displayAmount })
+ : t('Positive amount: {{amount}}', { amount: displayAmount })
+ }
style={{
alignItems: 'center',
flexGrow: 1,
diff --git a/packages/desktop-client/src/components/reports/reports/CalendarCard.tsx b/packages/desktop-client/src/components/reports/reports/CalendarCard.tsx
index 346062356c..65af1a5753 100644
--- a/packages/desktop-client/src/components/reports/reports/CalendarCard.tsx
+++ b/packages/desktop-client/src/components/reports/reports/CalendarCard.tsx
@@ -343,6 +343,7 @@ function CalendarCardInner({
widgetId,
isEditing,
}: CalendarCardInnerProps) {
+ const { t } = useTranslation();
const [monthNameVisible, setMonthNameVisible] = useState(true);
const monthFormatSizeContainers = useRef<(HTMLSpanElement | null)[]>(
new Array(5),
@@ -474,7 +475,7 @@ function CalendarCardInner({
fontSize: '10px',
marginRight: 10,
}}
- aria-label="Income"
+ aria-label={t('Income')}
>
{calendar.totalIncome !== 0 ? (
<>
@@ -497,7 +498,7 @@ function CalendarCardInner({
flexDirection: 'row',
fontSize: '10px',
}}
- aria-label="Expenses"
+ aria-label={t('Expenses')}
>
{calendar.totalExpense !== 0 ? (
<>
diff --git a/packages/desktop-client/src/components/reports/reports/CustomReportListCards.tsx b/packages/desktop-client/src/components/reports/reports/CustomReportListCards.tsx
index 57ab8eb0fc..3fd4c42ed1 100644
--- a/packages/desktop-client/src/components/reports/reports/CustomReportListCards.tsx
+++ b/packages/desktop-client/src/components/reports/reports/CustomReportListCards.tsx
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
-import { useTranslation } from 'react-i18next';
+import { Trans, useTranslation } from 'react-i18next';
import { SvgExclamationSolid } from '@actual-app/components/icons/v1';
import { styles } from '@actual-app/components/styles';
@@ -37,14 +37,12 @@ export function CustomReportListCards({
report,
onRemove,
}: CustomReportListCardsProps) {
- const { t } = useTranslation();
-
// It's possible for a dashboard to reference a non-existing
// custom report
if (!report) {
return (
<MissingReportCard isEditing={isEditing} onRemove={onRemove}>
- {t('This custom report has been deleted.')}
+ <Trans>This custom report has been deleted.</Trans>
</MissingReportCard>
);
}
@@ -65,6 +63,8 @@ function CustomReportListCardsInner({
}: Omit<CustomReportListCardsProps, 'report'> & {
report: CustomReportEntity;
}) {
+ const { t } = useTranslation();
+
const dispatch = useDispatch();
const [nameMenuOpen, setNameMenuOpen] = useState(false);
@@ -104,7 +104,9 @@ function CustomReportListCardsInner({
addNotification({
notification: {
type: 'error',
- message: `Failed saving report name: ${response.error.message}`,
+ message: t('Failed saving report name: {{error}}', {
+ error: response.error.message,
+ }),
},
}),
);
@@ -123,11 +125,11 @@ function CustomReportListCardsInner({
menuItems={[
{
name: 'rename',
- text: 'Rename',
+ text: t('Rename'),
},
{
name: 'remove',
- text: 'Remove',
+ text: t('Remove'),
},
]}
onMenuSelect={item => {
@@ -177,7 +179,9 @@ function CustomReportListCardsInner({
{hasWarning && (
<View style={{ padding: 5, position: 'absolute', bottom: 0 }}>
<Tooltip
- content="The widget is configured to use a non-existing filter value (i.e. category/account/payee). Edit the filters used in this report widget to remove the warning."
+ content={t(
+ 'The widget is configured to use a non-existing filter value (i.e. category/account/payee). Edit the filters used in this report widget to remove the warning.',
+ )}
placement="bottom start"
style={{ ...styles.tooltip, maxWidth: 300 }}
>
diff --git a/packages/desktop-client/src/components/reports/reports/GetCardData.tsx b/packages/desktop-client/src/components/reports/reports/GetCardData.tsx
index 2cd72ef3a7..51da346a79 100644
--- a/packages/desktop-client/src/components/reports/reports/GetCardData.tsx
+++ b/packages/desktop-client/src/components/reports/reports/GetCardData.tsx
@@ -1,6 +1,6 @@
import React, { useMemo } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
-import { useTranslation } from 'react-i18next';
+import { Trans } from 'react-i18next';
import { useResponsive } from '@actual-app/components/hooks/useResponsive';
import { styles } from '@actual-app/components/styles';
@@ -26,14 +26,13 @@ import { createGroupedSpreadsheet } from '@desktop-client/components/reports/spr
import { useReport } from '@desktop-client/components/reports/useReport';
function ErrorFallback() {
- const { t } = useTranslation();
return (
<>
<div>
<br />
</div>
<Text style={{ ...styles.mediumText, color: theme.errorText }}>
- {t('There was a problem loading your report')}
+ <Trans>There was a problem loading your report</Trans>
</Text>
</>
);
diff --git a/packages/desktop-client/src/components/reports/reports/Summary.tsx b/packages/desktop-client/src/components/reports/reports/Summary.tsx
index 90e219fb4d..beeccd2cf9 100644
--- a/packages/desktop-client/src/components/reports/reports/Summary.tsx
+++ b/packages/desktop-client/src/components/reports/reports/Summary.tsx
@@ -362,7 +362,7 @@ function SummaryInner({ widget }: SummaryInnerProps) {
}));
}}
/>{' '}
- {t('All time divisor')}
+ <Trans>All time divisor</Trans>
</View>
)}
</View>
diff --git a/packages/desktop-client/src/components/rules/ScheduleValue.tsx b/packages/desktop-client/src/components/rules/ScheduleValue.tsx
index e95f92711d..1a3c56e706 100644
--- a/packages/desktop-client/src/components/rules/ScheduleValue.tsx
+++ b/packages/desktop-client/src/components/rules/ScheduleValue.tsx
@@ -1,4 +1,5 @@
import React, { useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
import { AnimatedLoading } from '@actual-app/components/icons/AnimatedLoading';
import { View } from '@actual-app/components/view';
@@ -18,6 +19,7 @@ type ScheduleValueProps = {
};
export function ScheduleValue({ value }: ScheduleValueProps) {
+ const { t } = useTranslation();
const payees = usePayees();
const byId = getPayeesById(payees);
const schedulesQuery = useMemo(() => q('schedules').select('*'), []);
@@ -25,7 +27,7 @@ export function ScheduleValue({ value }: ScheduleValueProps) {
if (isLoading) {
return (
- <View aria-label="Loading..." style={{ display: 'inline-flex' }}>
+ <View aria-label={t('Loading...')} style={{ display: 'inline-flex' }}>
<AnimatedLoading width={10} height={10} />
</View>
);
diff --git a/packages/desktop-client/src/components/settings/UI.tsx b/packages/desktop-client/src/components/settings/UI.tsx
index 8e4330dd59..44413b8d54 100644
--- a/packages/desktop-client/src/components/settings/UI.tsx
+++ b/packages/desktop-client/src/components/settings/UI.tsx
@@ -1,5 +1,5 @@
import React, { useState, type ReactNode } from 'react';
-import { useTranslation } from 'react-i18next';
+import { Trans } from 'react-i18next';
import { useLocation } from 'react-router';
import { type CSSProperties } from '@actual-app/components/styles';
@@ -51,7 +51,6 @@ type AdvancedToggleProps = {
};
export const AdvancedToggle = ({ children }: AdvancedToggleProps) => {
- const { t } = useTranslation();
const location = useLocation();
const [expanded, setExpanded] = useState(location.hash === '#advanced');
@@ -76,7 +75,7 @@ export const AdvancedToggle = ({ children }: AdvancedToggleProps) => {
}}
>
<View style={{ fontSize: 20, fontWeight: 500, flexShrink: 0 }}>
- {t('Advanced Settings')}
+ <Trans>Advanced Settings</Trans>
</View>
{children}
</View>
@@ -92,7 +91,7 @@ export const AdvancedToggle = ({ children }: AdvancedToggleProps) => {
marginBottom: 25,
}}
>
- {t('Show advanced settings')}
+ <Trans>Show advanced settings</Trans>
</Link>
);
};
diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.tsx b/packages/desktop-client/src/components/transactions/TransactionsTable.tsx
index c60c6e3abe..8fe99dda89 100644
--- a/packages/desktop-client/src/components/transactions/TransactionsTable.tsx
+++ b/packages/desktop-client/src/components/transactions/TransactionsTable.tsx
@@ -589,7 +589,9 @@ function PayeeCell({
<Tooltip
content={
<View style={{ padding: 10 }}>
- <Text style={{ fontWeight: 'bold' }}>Imported Payee</Text>
+ <Text style={{ fontWeight: 'bold' }}>
+ <Trans>Imported Payee</Trans>
+ </Text>
<Text style={{ fontWeight: 'normal' }}>
{importedPayee}
</Text>
@@ -665,7 +667,9 @@ function PayeeCell({
<Tooltip
content={
<View style={{ padding: 10 }}>
- <Text style={{ fontWeight: 'bold' }}>Imported Payee</Text>
+ <Text style={{ fontWeight: 'bold' }}>
+ <Trans>Imported Payee</Trans>
+ </Text>
<Text style={{ fontWeight: 'normal' }}>
{importedPayee}
</Text>
@@ -738,6 +742,8 @@ function PayeeIcons({
onNavigateToTransferAccount,
onNavigateToSchedule,
}: PayeeIconsProps) {
+ const { t } = useTranslation();
+
const scheduleId = transaction.schedule;
const { isLoading, schedules = [] } = useCachedSchedules();
@@ -761,7 +767,7 @@ function PayeeIcons({
<Button
variant="bare"
data-testid="schedule-icon"
- aria-label="See schedule details"
+ aria-label={t('See schedule details')}
style={payeeIconButtonStyle}
onPress={() => {
if (scheduleId) {
@@ -780,7 +786,7 @@ function PayeeIcons({
<Button
variant="bare"
data-testid="transfer-icon"
- aria-label="See transfer account"
+ aria-label={t('See transfer account')}
style={payeeIconButtonStyle}
onPress={() => {
if (!isTemporaryId(transaction.id)) {
@@ -897,6 +903,8 @@ const Transaction = memo(function Transaction({
showSelection,
allowSplitTransaction,
}: TransactionProps) {
+ const { t } = useTranslation();
+
const dispatch = useDispatch();
const dispatchSelected = useSelectedDispatch();
const triggerRef = useRef(null);
@@ -1449,7 +1457,7 @@ const Transaction = memo(function Transaction({
userSelect: 'none',
}}
>
- Split
+ <Trans>Split</Trans>
</Text>
)}
</View>
@@ -1466,13 +1474,13 @@ const Transaction = memo(function Transaction({
onExpose={name => onEdit(id, name)}
value={
isParent
- ? 'Split'
+ ? t('Split')
: isOffBudget
- ? 'Off budget'
+ ? t('Off budget')
: isBudgetTransfer
? categoryId != null
- ? 'Needs Repair'
- : 'Transfer'
+ ? t('Needs Repair')
+ : t('Transfer')
: ''
}
valueStyle={valueStyle}
@@ -1497,7 +1505,7 @@ const Transaction = memo(function Transaction({
value
? (getCategoriesById(categoryGroups)[value]?.name ?? '')
: transaction.id
- ? 'Categorize'
+ ? t('Categorize')
: ''
}
exposed={focusedField === 'category'}
@@ -1679,7 +1687,7 @@ function TransactionError({
data-testid="transaction-error"
>
<Text>
- Amount left:{' '}
+ <Trans>Amount left:</Trans>{' '}
<Text style={{ fontWeight: 500 }}>
{integerToCurrency(
isDeposit ? error.difference : -error.difference,
@@ -1694,7 +1702,7 @@ function TransactionError({
data-testid="distribute-split-button"
isDisabled={!canDistributeRemainder}
>
- Distribute
+ <Trans>Distribute</Trans>
</Button>
<Button
variant="primary"
@@ -1702,7 +1710,7 @@ function TransactionError({
onPress={onAddSplit}
data-testid="add-split-button"
>
- Add Split
+ <Trans>Add Split</Trans>
</Button>
</View>
);
@@ -2301,6 +2309,8 @@ export const TransactionTable = forwardRef(
props: TransactionTableProps,
ref: ForwardedRef<TableHandleRef<TransactionEntity>>,
) => {
+ const { t } = useTranslation();
+
const dispatch = useDispatch();
const [newTransactions, setNewTransactions] = useState<
TransactionEntity[] | null
@@ -2450,7 +2460,7 @@ export const TransactionTable = forwardRef(
addNotification({
notification: {
type: 'error',
- message: 'Account is a required field',
+ message: t('Account is a required field'),
},
}),
);
diff --git a/packages/desktop-client/src/components/util/AmountInput.tsx b/packages/desktop-client/src/components/util/AmountInput.tsx
index d67eeb88f6..0df7a5283c 100644
--- a/packages/desktop-client/src/components/util/AmountInput.tsx
+++ b/packages/desktop-client/src/components/util/AmountInput.tsx
@@ -59,6 +59,7 @@ export function AmountInput({
disabled = false,
autoDecimals = false,
}: AmountInputProps) {
+ const { t } = useTranslation();
const format = useFormat();
const [symbol, setSymbol] = useState<'+' | '-'>(
initialValue === 0 ? zeroSign : initialValue > 0 ? '+' : '-',
@@ -136,7 +137,7 @@ export function AmountInput({
<Button
variant="bare"
isDisabled={disabled}
- aria-label={`Make ${symbol === '-' ? 'positive' : 'negative'}`}
+ aria-label={symbol === '-' ? t('Make positive') : t('Make negative')}
style={{ padding: '0 7px' }}
onPress={onSwitch}
ref={buttonRef}
diff --git a/upcoming-release-notes/5209.md b/upcoming-release-notes/5209.md
new file mode 100644
index 0000000000..ffe392ca63
--- /dev/null
+++ b/upcoming-release-notes/5209.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [matt-fidd]
+---
+
+Mark more files for translation