[PR #3893] [MERGED] Use useTranslation hook instead of directly importing the t function #5112

Closed
opened 2026-02-28 21:06:11 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/3893
Author: @joel-jeremy
Created: 11/25/2024
Status: Merged
Merged: 12/11/2024
Merged by: @joel-jeremy

Base: masterHead: useTranslation-instead-of-direct-import


📝 Commits (3)

  • 49267e2 Use useTranslation hook instead of directly importing the t function
  • 8e9673c Release notes
  • ecdddbb Fix lint

📊 Changes

56 files changed (+202 additions, -146 deletions)

View changed files

📝 packages/desktop-client/src/components/ManageRulesPage.tsx (+2 -2)
📝 packages/desktop-client/src/components/Notes.tsx (+2 -1)
📝 packages/desktop-client/src/components/NotesButton.tsx (+2 -2)
📝 packages/desktop-client/src/components/Notifications.tsx (+2 -1)
📝 packages/desktop-client/src/components/ThemeSelector.tsx (+2 -2)
📝 packages/desktop-client/src/components/Titlebar.tsx (+3 -1)
📝 packages/desktop-client/src/components/accounts/AccountSyncCheck.tsx (+63 -56)
📝 packages/desktop-client/src/components/common/Modal.tsx (+4 -1)
📝 packages/desktop-client/src/components/mobile/MobileBackButton.tsx (+2 -2)
📝 packages/desktop-client/src/components/mobile/accounts/Accounts.tsx (+3 -2)
📝 packages/desktop-client/src/components/mobile/budget/BudgetTable.jsx (+10 -1)
📝 packages/desktop-client/src/components/mobile/transactions/AddTransactionButton.tsx (+2 -2)
📝 packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx (+3 -1)
📝 packages/desktop-client/src/components/mobile/transactions/TransactionList.jsx (+0 -1)
📝 packages/desktop-client/src/components/mobile/transactions/TransactionListWithBalances.jsx (+3 -2)
📝 packages/desktop-client/src/components/modals/BudgetListModal.tsx (+2 -2)
📝 packages/desktop-client/src/components/modals/CategoryAutocompleteModal.tsx (+2 -2)
📝 packages/desktop-client/src/components/modals/CategoryGroupMenuModal.tsx (+3 -2)
📝 packages/desktop-client/src/components/modals/CategoryMenuModal.tsx (+3 -2)
📝 packages/desktop-client/src/components/modals/CreateEncryptionKeyModal.tsx (+2 -1)

...and 36 more files

📄 Description

We should use useTranslation instead of directly import the t function because useTranslation has some functionalities that are specific to react e.g. rerendering the components when language changes

There are still some direct imports left in loot-core. We need to assess if we should translate strings at that level or we should do all translations in the desktop-client/component level.

https://github.com/actualbudget/actual/issues/3329


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/3893 **Author:** [@joel-jeremy](https://github.com/joel-jeremy) **Created:** 11/25/2024 **Status:** ✅ Merged **Merged:** 12/11/2024 **Merged by:** [@joel-jeremy](https://github.com/joel-jeremy) **Base:** `master` ← **Head:** `useTranslation-instead-of-direct-import` --- ### 📝 Commits (3) - [`49267e2`](https://github.com/actualbudget/actual/commit/49267e2445648b638274cc642d3d13b54122dced) Use useTranslation hook instead of directly importing the t function - [`8e9673c`](https://github.com/actualbudget/actual/commit/8e9673cfdf76862ad577c0ac474f9e4c2fb0cdeb) Release notes - [`ecdddbb`](https://github.com/actualbudget/actual/commit/ecdddbb8080b4bcccb139eed5a2bd9cef5bd10fa) Fix lint ### 📊 Changes **56 files changed** (+202 additions, -146 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/components/ManageRulesPage.tsx` (+2 -2) 📝 `packages/desktop-client/src/components/Notes.tsx` (+2 -1) 📝 `packages/desktop-client/src/components/NotesButton.tsx` (+2 -2) 📝 `packages/desktop-client/src/components/Notifications.tsx` (+2 -1) 📝 `packages/desktop-client/src/components/ThemeSelector.tsx` (+2 -2) 📝 `packages/desktop-client/src/components/Titlebar.tsx` (+3 -1) 📝 `packages/desktop-client/src/components/accounts/AccountSyncCheck.tsx` (+63 -56) 📝 `packages/desktop-client/src/components/common/Modal.tsx` (+4 -1) 📝 `packages/desktop-client/src/components/mobile/MobileBackButton.tsx` (+2 -2) 📝 `packages/desktop-client/src/components/mobile/accounts/Accounts.tsx` (+3 -2) 📝 `packages/desktop-client/src/components/mobile/budget/BudgetTable.jsx` (+10 -1) 📝 `packages/desktop-client/src/components/mobile/transactions/AddTransactionButton.tsx` (+2 -2) 📝 `packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx` (+3 -1) 📝 `packages/desktop-client/src/components/mobile/transactions/TransactionList.jsx` (+0 -1) 📝 `packages/desktop-client/src/components/mobile/transactions/TransactionListWithBalances.jsx` (+3 -2) 📝 `packages/desktop-client/src/components/modals/BudgetListModal.tsx` (+2 -2) 📝 `packages/desktop-client/src/components/modals/CategoryAutocompleteModal.tsx` (+2 -2) 📝 `packages/desktop-client/src/components/modals/CategoryGroupMenuModal.tsx` (+3 -2) 📝 `packages/desktop-client/src/components/modals/CategoryMenuModal.tsx` (+3 -2) 📝 `packages/desktop-client/src/components/modals/CreateEncryptionKeyModal.tsx` (+2 -1) _...and 36 more files_ </details> ### 📄 Description <!-- Thank you for submitting a pull request! Make sure to follow the instructions to write release notes for your PR — it should only take a minute or two: https://github.com/actualbudget/docs#writing-good-release-notes --> We should use `useTranslation` instead of directly import the `t` function because `useTranslation` has some functionalities that are specific to react e.g. rerendering the components when language changes There are still some direct imports left in loot-core. We need to assess if we should translate strings at that level or we should do all translations in the desktop-client/component level. https://github.com/actualbudget/actual/issues/3329 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-02-28 21:06:11 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#5112