A local-first personal finance app
fix translations on the "new transaction" and "list" page on mobile (#5471)
milanalexandref328332ab203
diff --git a/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx b/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsxindex 7b157248c7..5f53b79237 100644--- a/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx+++ b/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx@@ -328,6 +328,7 @@ const ChildTransactionEdit = forwardRef(const { editingField, onRequestActiveEdit, onClearActiveEdit } =useSingleActiveEditForm();const prettyPayee = getPrettyPayee({+ t,transaction,payee: getPayee(transaction),transferAccount: getTransferAccount(transaction),@@ -807,6 +808,7 @@ const TransactionEditInner = memo(function TransactionEditInner({const account = getAccount(transaction);const isOffBudget = account && !!account.offbudget;const title = getPrettyPayee({+ t,transaction,payee: getPayee(transaction),transferAccount: getTransferAccount(transaction),diff --git a/packages/desktop-client/src/components/mobile/transactions/TransactionListItem.tsx b/packages/desktop-client/src/components/mobile/transactions/TransactionListItem.tsxindex f677f60ed1..d84f93474f 100644--- a/packages/desktop-client/src/components/mobile/transactions/TransactionListItem.tsx+++ b/packages/desktop-client/src/components/mobile/transactions/TransactionListItem.tsx@@ -135,11 +135,11 @@ export function TransactionListItem({const isAdded = newTransactions.includes(id);const categoryName = lookupName(categories, categoryId);const specialCategory = account?.offbudget- ? 'Off budget'+ ? t('Off budget'): transferAccount && !transferAccount.offbudget- ? 'Transfer'+ ? t('Transfer'): isParent- ? 'Split'+ ? t('Split'): null;const prettyCategory = specialCategory || categoryName;@@ -264,7 +264,7 @@ export function TransactionListItem({textAlign: 'left',}}>- {prettyCategory || 'Uncategorized'}+ {prettyCategory || t('Uncategorized')}</TextOneLine></View>)}diff --git a/packages/desktop-client/src/components/mobile/utils.ts b/packages/desktop-client/src/components/mobile/utils.tsindex db935fd748..43719f063f 100644--- a/packages/desktop-client/src/components/mobile/utils.ts+++ b/packages/desktop-client/src/components/mobile/utils.ts@@ -1,3 +1,5 @@+import { type useTranslation } from 'react-i18next';+import {type AccountEntity,type PayeeEntity,@@ -5,12 +7,14 @@ import {} from 'loot-core/types/models';type GetPrettyPayeeProps = {+ t: ReturnType<typeof useTranslation>['t'];transaction?: TransactionEntity;payee?: PayeeEntity;transferAccount?: AccountEntity;};export function getPrettyPayee({+ t,transaction,payee,transferAccount,@@ -20,9 +24,12 @@ export function getPrettyPayee({}if (transferAccount) {- return `Transfer ${transaction?.amount > 0 ? 'from' : 'to'} ${transferAccount.name}`;+ return t('Transfer {{direction}} {{accountName}}', {+ direction: transaction?.amount > 0 ? t('from') : t('to'),+ accountName: transferAccount.name,+ });} else if (transaction.is_parent) {- return 'Split';+ return t('Split');} else if (payee) {return payee.name;}diff --git a/upcoming-release-notes/5471.md b/upcoming-release-notes/5471.mdnew file mode 100644index 0000000000..58c6681fa0--- /dev/null+++ b/upcoming-release-notes/5471.md@@ -0,0 +1,6 @@+---+category: Bugfix+authors: [milanalexandre]+---++Adds translations to the "new transaction" page on mobile devices