[PR #3036] [MERGED] feat: introduce i18n framework #4650

Closed
opened 2026-02-28 20:59:07 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/3036
Author: @julianwachholz
Created: 7/11/2024
Status: Merged
Merged: 8/11/2024
Merged by: @jfdoming

Base: masterHead: i18n-preparation


📝 Commits (7)

📊 Changes

23 files changed (+1069 additions, -193 deletions)

View changed files

📝 package.json (+1 -0)
packages/desktop-client/i18next-parser.config.js (+14 -0)
📝 packages/desktop-client/package.json (+5 -0)
📝 packages/desktop-client/src/components/App.tsx (+9 -5)
📝 packages/desktop-client/src/components/common/Menu.tsx (+1 -1)
📝 packages/desktop-client/src/components/manager/ConfigServer.tsx (+20 -14)
📝 packages/desktop-client/src/components/manager/WelcomeScreen.tsx (+45 -30)
📝 packages/desktop-client/src/components/manager/subscribe/Bootstrap.tsx (+20 -14)
📝 packages/desktop-client/src/components/schedules/ScheduleDetails.jsx (+4 -1)
📝 packages/desktop-client/src/components/table.tsx (+22 -7)
📝 packages/desktop-client/src/components/transactions/SelectedTransactionsButton.jsx (+37 -34)
📝 packages/desktop-client/src/hooks/useSelected.tsx (+1 -1)
packages/desktop-client/src/i18n.ts (+29 -0)
📝 packages/desktop-client/src/index.tsx (+2 -0)
📝 packages/loot-core/package.json (+2 -0)
📝 packages/loot-core/src/client/actions/budgets.ts (+24 -9)
📝 packages/loot-core/src/client/actions/notifications.ts (+4 -2)
📝 packages/loot-core/src/client/actions/queries.ts (+3 -1)
📝 packages/loot-core/src/client/shared-listeners.ts (+82 -51)
📝 packages/loot-core/src/client/update-notification.ts (+7 -3)

...and 3 more files

📄 Description

Let's re-start efforts to bring Actual Budgets to a broader audience by translating the app into different languages.

Previous work: #205

This PR introduces i18next as internationalization framework to lay the groundwork on getting Actual Budget translated into other languages. It features the following concepts:

  • Text is marked for translation using the t() function or <Trans> component.
  • Translatable strings use natural language (English) - no changes to the string literals is being made.
  • Texts are extracted using i18next-parser into a base en JSON file. A shorthand yarn generate:i18n was added to the package.json.
    • Texts from both desktop-client and loot-core are extracted into the same single file located within desktop-client. This reduces complexity by not having to manage multiple namespaces.
  • During a future release process, other language files sourced from a translation service will be placed in the same folder.
  • At runtime, these JSON message catalogues are loaded with a dynamic import to minimize memory usage of the app.

Other notes:

  • To reduce burden on maintainers with endless typo and punctuation updates, I propose setting up a project with Weblate. Weblate offers free hosting for open source projects and is itself also self-hostable, much in the spirit of Actual Budget. :)
  • Using a crowd sourcing application like above will offload individual translation contributions to a separately managed app. Each release cycle will likely only produce one PR to be merged before the release is made.
  • When merged, this PR will change nothing for existing installations. All newly marked-for-translation strings will simply default to the original English language texts. (with the only exception being my added plural example on the transactions list, this wasn't pluralized previously)

🔄 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/3036 **Author:** [@julianwachholz](https://github.com/julianwachholz) **Created:** 7/11/2024 **Status:** ✅ Merged **Merged:** 8/11/2024 **Merged by:** [@jfdoming](https://github.com/jfdoming) **Base:** `master` ← **Head:** `i18n-preparation` --- ### 📝 Commits (7) - [`d3bec5b`](https://github.com/actualbudget/actual/commit/d3bec5b70153e3d46c65d35fdbe31564d0f33ad5) feat: introduce i18n framework - [`5776632`](https://github.com/actualbudget/actual/commit/5776632562fce82b1c6b0f82964134d6ac008d21) Incorporate review feedback - [`1ada531`](https://github.com/actualbudget/actual/commit/1ada5317580e038ed538fe7048b5e5b6c48f9f48) Patch demo - [`9b0513c`](https://github.com/actualbudget/actual/commit/9b0513c90a3d5ea6a736d5ac145f08ff3d77d183) remove unnecessary arguments - [`ba232df`](https://github.com/actualbudget/actual/commit/ba232df3ec0aad4439b5ba1c169264eab01dadd6) Consistently use t() function - [`2fce969`](https://github.com/actualbudget/actual/commit/2fce9692e81d794d54d1573707bca9bcb0e1be06) Fix typing issue - [`3e10c20`](https://github.com/actualbudget/actual/commit/3e10c20ac9e999a37986816376b0262a8677f32b) Fix e2e tests ### 📊 Changes **23 files changed** (+1069 additions, -193 deletions) <details> <summary>View changed files</summary> 📝 `package.json` (+1 -0) ➕ `packages/desktop-client/i18next-parser.config.js` (+14 -0) 📝 `packages/desktop-client/package.json` (+5 -0) 📝 `packages/desktop-client/src/components/App.tsx` (+9 -5) 📝 `packages/desktop-client/src/components/common/Menu.tsx` (+1 -1) 📝 `packages/desktop-client/src/components/manager/ConfigServer.tsx` (+20 -14) 📝 `packages/desktop-client/src/components/manager/WelcomeScreen.tsx` (+45 -30) 📝 `packages/desktop-client/src/components/manager/subscribe/Bootstrap.tsx` (+20 -14) 📝 `packages/desktop-client/src/components/schedules/ScheduleDetails.jsx` (+4 -1) 📝 `packages/desktop-client/src/components/table.tsx` (+22 -7) 📝 `packages/desktop-client/src/components/transactions/SelectedTransactionsButton.jsx` (+37 -34) 📝 `packages/desktop-client/src/hooks/useSelected.tsx` (+1 -1) ➕ `packages/desktop-client/src/i18n.ts` (+29 -0) 📝 `packages/desktop-client/src/index.tsx` (+2 -0) 📝 `packages/loot-core/package.json` (+2 -0) 📝 `packages/loot-core/src/client/actions/budgets.ts` (+24 -9) 📝 `packages/loot-core/src/client/actions/notifications.ts` (+4 -2) 📝 `packages/loot-core/src/client/actions/queries.ts` (+3 -1) 📝 `packages/loot-core/src/client/shared-listeners.ts` (+82 -51) 📝 `packages/loot-core/src/client/update-notification.ts` (+7 -3) _...and 3 more files_ </details> ### 📄 Description Let's re-start efforts to bring Actual Budgets to a broader audience by translating the app into different languages. Previous work: #205 This PR introduces [i18next](https://www.i18next.com/) as internationalization framework to lay the groundwork on getting Actual Budget translated into other languages. It features the following concepts: - Text is marked for translation using the [`t()`](https://www.i18next.com/overview/api#t) function or [`<Trans>`](https://react.i18next.com/latest/trans-component) component. - Translatable strings use natural language (English) - no changes to the string literals is being made. - Texts are extracted using [`i18next-parser`](https://github.com/i18next/i18next-parser) into a base `en` JSON file. A shorthand `yarn generate:i18n` was added to the `package.json`. - Texts from both `desktop-client` and `loot-core` are extracted into the same single file located within `desktop-client`. This reduces complexity by not having to manage multiple namespaces. - During a future release process, other language files sourced from a translation service will be placed in the same folder. - At runtime, these JSON message catalogues are loaded with a dynamic import to minimize memory usage of the app. Other notes: - To reduce burden on maintainers with endless typo and punctuation updates, I propose setting up a project with [Weblate](https://weblate.org). Weblate offers free hosting for open source projects and is itself also self-hostable, much in the spirit of Actual Budget. :) - Using a crowd sourcing application like above will offload individual translation contributions to a separately managed app. Each release cycle will likely only produce one PR to be merged before the release is made. - When merged, this PR will change nothing for existing installations. All newly marked-for-translation strings will simply default to the original English language texts. (with the only exception being my added plural example on the transactions list, this wasn't pluralized previously) --- <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 20:59:07 -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#4650