Skip to content

A local-first personal finance app

Fix/i18n translate status and date (#5411)

milanalexandre1ad3406e848c
diff --git a/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx b/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx
index 50062b3aae..7b157248c7 100644
--- a/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx
+++ b/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx
@@ -34,6 +34,7 @@ import { send } from 'loot-core/platform/client/fetch';
import * as monthUtils from 'loot-core/shared/months';
import * as Platform from 'loot-core/shared/platform';
import { q } from 'loot-core/shared/query';
+import { getStatusLabel } from 'loot-core/shared/schedules';
import {
ungroupTransactions,
updateTransaction,
@@ -164,8 +165,10 @@ export function Status({ status, isSplit }) {
}}
>
{isSplit
- ? t('{{status}} (Split)', { status: titleFirst(status) })
- : titleFirst(status)}
+ ? t('{{status}} (Split)', {
+ status: titleFirst(getStatusLabel(status)),
+ })
+ : titleFirst(getStatusLabel(status))}
</Text>
);
}
diff --git a/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.jsx b/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.jsx
index 34e1ec1e12..34cf00eb9e 100644
--- a/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.jsx
+++ b/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.jsx
@@ -579,7 +579,7 @@ export function ImportTransactionsModal({
if (date == null) {
errorMessage = t(
'Unable to parse date {{date}} with given date format',
- { date: trans.date || '(empty)' },
+ { date: trans.date || t('(empty)') },
);
break;
}
diff --git a/packages/desktop-client/src/components/schedules/StatusBadge.tsx b/packages/desktop-client/src/components/schedules/StatusBadge.tsx
index 95df3a2843..f0c6df84f2 100644
--- a/packages/desktop-client/src/components/schedules/StatusBadge.tsx
+++ b/packages/desktop-client/src/components/schedules/StatusBadge.tsx
@@ -14,6 +14,7 @@ import { Text } from '@actual-app/components/text';
import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';
+import { getStatusLabel } from 'loot-core/shared/schedules';
import { titleFirst } from 'loot-core/shared/util';
import { type ScheduleStatusType } from '@desktop-client/hooks/useSchedules';
@@ -113,7 +114,9 @@ export function StatusBadge({ status }: { status: ScheduleStatusType }) {
marginRight: 7,
}}
/>
- <Text style={{ lineHeight: '1em' }}>{titleFirst(status)}</Text>
+ <Text style={{ lineHeight: '1em' }}>
+ {titleFirst(getStatusLabel(status))}
+ </Text>
</View>
);
}
diff --git a/packages/desktop-client/src/components/settings/AuthSettings.tsx b/packages/desktop-client/src/components/settings/AuthSettings.tsx
index 6d62d63ed6..e8a5803794 100644
--- a/packages/desktop-client/src/components/settings/AuthSettings.tsx
+++ b/packages/desktop-client/src/components/settings/AuthSettings.tsx
@@ -53,7 +53,7 @@ export function AuthSettings() {
)
}
>
- Start using OpenID
+ <Trans>Start using OpenID</Trans>
</Button>
<Label
style={{ paddingTop: 5 }}
diff --git a/packages/desktop-client/src/components/settings/index.tsx b/packages/desktop-client/src/components/settings/index.tsx
index 17d293f885..0a15a0f093 100644
--- a/packages/desktop-client/src/components/settings/index.tsx
+++ b/packages/desktop-client/src/components/settings/index.tsx
@@ -115,6 +115,7 @@ function IDName({ children }: { children: ReactNode }) {
function AdvancedAbout() {
const [budgetId] = useMetadataPref('id');
const [groupId] = useMetadataPref('groupId');
+ const { t } = useTranslation();
return (
<Setting>
@@ -133,15 +134,15 @@ function AdvancedAbout() {
</Text>
<Text style={{ color: theme.pageText }}>
<Trans>
- <IDName>Sync ID:</IDName> {{ syncId: groupId || '(none)' }}
+ <IDName>Sync ID:</IDName> {{ syncId: groupId || t('(none)') }}
</Trans>
</Text>
{/* low priority todo: eliminate some or all of these, or decide when/if to show them */}
{/* <Text>
- <IDName>Cloud File ID:</IDName> {prefs.cloudFileId || '(none)'}
+ <IDName>Cloud File ID:</IDName> {prefs.cloudFileId || t('(none)')}
</Text>
<Text>
- <IDName>User ID:</IDName> {prefs.userId || '(none)'}
+ <IDName>User ID:</IDName> {prefs.userId || t('(none)')}
</Text> */}
</Setting>
);
diff --git a/packages/desktop-client/src/components/sidebar/BalanceHistoryGraph.tsx b/packages/desktop-client/src/components/sidebar/BalanceHistoryGraph.tsx
index 58c966e36c..9a95959e08 100644
--- a/packages/desktop-client/src/components/sidebar/BalanceHistoryGraph.tsx
+++ b/packages/desktop-client/src/components/sidebar/BalanceHistoryGraph.tsx
@@ -5,7 +5,7 @@ import { styles } from '@actual-app/components/styles';
import { Text } from '@actual-app/components/text';
import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';
-import { subMonths, format, eachMonthOfInterval, parseISO } from 'date-fns';
+import { subMonths, format, eachMonthOfInterval } from 'date-fns';
import { LineChart, Line, YAxis, Tooltip as RechartsTooltip } from 'recharts';
import * as monthUtils from 'loot-core/shared/months';
@@ -14,6 +14,7 @@ import { integerToCurrency } from 'loot-core/shared/util';
import { PrivacyFilter } from '@desktop-client/components/PrivacyFilter';
import { LoadingIndicator } from '@desktop-client/components/reports/LoadingIndicator';
+import { useLocale } from '@desktop-client/hooks/useLocale';
import { aqlQuery } from '@desktop-client/queries/aqlQuery';
const CHART_HEIGHT = 70;
@@ -31,6 +32,7 @@ type Balance = {
};
export function BalanceHistoryGraph({ accountId }: BalanceHistoryGraphProps) {
+ const locale = useLocale();
const [balanceData, setBalanceData] = useState<
Array<{ date: string; balance: number }>
>([]);
@@ -139,7 +141,7 @@ export function BalanceHistoryGraph({ accountId }: BalanceHistoryGraphProps) {
.map(t => {
return {
balance: t.balance,
- date: format(parseISO(t.date), 'MMM yyyy'),
+ date: monthUtils.format(t.date, 'MMM yyyy', locale),
};
});
@@ -149,7 +151,7 @@ export function BalanceHistoryGraph({ accountId }: BalanceHistoryGraphProps) {
}
fetchBalanceHistory();
- }, [accountId]);
+ }, [accountId, locale]);
// State to track if the chart is hovered (used to conditionally render PrivacyFilter)
const [isHovered, setIsHovered] = useState(false);
@@ -173,19 +175,19 @@ export function BalanceHistoryGraph({ accountId }: BalanceHistoryGraphProps) {
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
>
- <LineChart data={balanceData} width={CHART_WIDTH} height={CHART_HEIGHT}>
+ <LineChart
+ data={balanceData}
+ width={CHART_WIDTH}
+ height={CHART_HEIGHT}
+ onMouseMove={state => {
+ if (state && state.activePayload && state.activePayload[0]) {
+ setHoveredValue(state.activePayload[0].payload);
+ }
+ }}
+ >
<YAxis domain={['dataMin', 'dataMax']} hide={true} />
<RechartsTooltip
- contentStyle={{
- display: 'none',
- }}
- labelFormatter={(label, items) => {
- const data = items[0]?.payload;
- if (data) {
- setHoveredValue(data);
- }
- return '';
- }}
+ contentStyle={{ display: 'none' }}
isAnimationActive={false}
/>
<Line
diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.tsx b/packages/desktop-client/src/components/transactions/TransactionsTable.tsx
index 019bccef5e..b08fe0af5d 100644
--- a/packages/desktop-client/src/components/transactions/TransactionsTable.tsx
+++ b/packages/desktop-client/src/components/transactions/TransactionsTable.tsx
@@ -44,6 +44,7 @@ import { View } from '@actual-app/components/view';
import { format as formatDate, parseISO } from 'date-fns';
import * as monthUtils from 'loot-core/shared/months';
+import { getStatusLabel } from 'loot-core/shared/schedules';
import {
addSplitTransaction,
deleteTransaction,
@@ -1421,7 +1422,7 @@ const Transaction = memo(function Transaction({
display: 'inline-block',
}}
>
- {titleFirst(previewStatus ?? '')}
+ {titleFirst(getStatusLabel(previewStatus ?? ''))}
</View>
)}
<CellButton
diff --git a/upcoming-release-notes/5411.md b/upcoming-release-notes/5411.md
new file mode 100644
index 0000000000..e8b84ca7fd
--- /dev/null
+++ b/upcoming-release-notes/5411.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [milanalexandre]
+---
+
+Add status label translations for 'Schedules' and others