[PR #2681] [MERGED] feat(ci): bidirectional translation key validation for backend and frontend #10118

Closed
opened 2026-04-23 09:25:12 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2681
Author: @tink-bot
Created: 4/23/2026
Status: Merged
Merged: 4/23/2026
Merged by: @kolaente

Base: mainHead: worktree-agent-a7939d35


📝 Commits (7)

  • e07d1c1 feat(magefile): bidirectional translation key validation
  • 5b9ae77 fix(notifications): pass lang to overdue reminder translation
  • 69320b4 chore(i18n): remove unused backend translation keys
  • 5f46269 chore(i18n): remove unused frontend translation keys
  • b35d3dd ci: run frontend translation check as a hard failure
  • 7ea1252 refactor(magefile): consolidate api+frontend translation checks into one task
  • f0e21ed feat(magefile): detect indirect api translation key references

📊 Changes

5 files changed (+327 additions, -97 deletions)

View changed files

📝 .github/workflows/test.yml (+1 -1)
📝 frontend/src/i18n/lang/en.json (+2 -49)
📝 magefile.go (+320 -38)
📝 pkg/i18n/lang/en.json (+3 -8)
📝 pkg/models/notifications.go (+1 -1)

📄 Description

Reviewers of agent-authored PRs keep flagging dead translation keys and keys added to en.json without a $t() wiring. Move that check from human review into CI.

What's new

  • mage check:translations now also reports dead backend keys (present in pkg/i18n/lang/en.json but never referenced), alongside the existing missing-key detection. Dynamic i18n.TP call sites are covered by a small allowlist of key prefixes.
  • New mage check:frontendTranslations task does the same for frontend/src/i18n/lang/en.json, scanning .vue / .ts / .js for $t, t, i18n.t, i18n.global.t, $tc, tc, and <i18n-t keypath="...">. Template literals with ${...} contribute a usage prefix; string literals that exactly match a translation key are treated as usage hints so arrays of keys and programmatic lookups (like error.${code}) don't false-positive.
  • Both tasks are wired into a new frontend-check-translations CI job and the existing api-check-translations job. Either mismatch hard-fails CI.

Cleanup done

Running the new checks surfaced:

  • 5 dead backend keys (notifications.task.comment.mentioned_message, notifications.task.mentioned.message, and three notifications.common.actions.assigned_*) — removed from pkg/i18n/lang/en.json.
  • 47 dead frontend keys across filters, editor toolbar, misc, task, admin overview, migration, and auth namespaces — removed from frontend/src/i18n/lang/en.json.
  • One bug: i18n.T("notifications.task.overdue.overdue", ...) in pkg/models/notifications.go was missing its lang argument, so the key was being passed as the language code. Fixed.

The sibling language files under pkg/i18n/lang/ and frontend/src/i18n/lang/ will be reconciled on the next Crowdin sync.


🔄 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/go-vikunja/vikunja/pull/2681 **Author:** [@tink-bot](https://github.com/tink-bot) **Created:** 4/23/2026 **Status:** ✅ Merged **Merged:** 4/23/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `worktree-agent-a7939d35` --- ### 📝 Commits (7) - [`e07d1c1`](https://github.com/go-vikunja/vikunja/commit/e07d1c1b6d7bd0c1238778fd5561661104691c0e) feat(magefile): bidirectional translation key validation - [`5b9ae77`](https://github.com/go-vikunja/vikunja/commit/5b9ae77cff0d6af00b67b60745d8bba3dfecec47) fix(notifications): pass lang to overdue reminder translation - [`69320b4`](https://github.com/go-vikunja/vikunja/commit/69320b4ac1e8918be1d096b8b596c7e7eb50b61e) chore(i18n): remove unused backend translation keys - [`5f46269`](https://github.com/go-vikunja/vikunja/commit/5f46269da8f3d0626d82e6dc1d948589483987d7) chore(i18n): remove unused frontend translation keys - [`b35d3dd`](https://github.com/go-vikunja/vikunja/commit/b35d3ddf70bc53f0e94c049a6bf24eb927ba19dd) ci: run frontend translation check as a hard failure - [`7ea1252`](https://github.com/go-vikunja/vikunja/commit/7ea1252ae905f121cdcadbc1258a1283967b2a18) refactor(magefile): consolidate api+frontend translation checks into one task - [`f0e21ed`](https://github.com/go-vikunja/vikunja/commit/f0e21edfbb2ac2f7ba10ba5d7665abd546826143) feat(magefile): detect indirect api translation key references ### 📊 Changes **5 files changed** (+327 additions, -97 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/test.yml` (+1 -1) 📝 `frontend/src/i18n/lang/en.json` (+2 -49) 📝 `magefile.go` (+320 -38) 📝 `pkg/i18n/lang/en.json` (+3 -8) 📝 `pkg/models/notifications.go` (+1 -1) </details> ### 📄 Description Reviewers of agent-authored PRs keep flagging dead translation keys and keys added to `en.json` without a `$t()` wiring. Move that check from human review into CI. ## What's new - `mage check:translations` now also reports dead backend keys (present in `pkg/i18n/lang/en.json` but never referenced), alongside the existing missing-key detection. Dynamic `i18n.TP` call sites are covered by a small allowlist of key prefixes. - New `mage check:frontendTranslations` task does the same for `frontend/src/i18n/lang/en.json`, scanning `.vue` / `.ts` / `.js` for `$t`, `t`, `i18n.t`, `i18n.global.t`, `$tc`, `tc`, and `<i18n-t keypath="...">`. Template literals with `${...}` contribute a usage prefix; string literals that exactly match a translation key are treated as usage hints so arrays of keys and programmatic lookups (like `error.${code}`) don't false-positive. - Both tasks are wired into a new `frontend-check-translations` CI job and the existing `api-check-translations` job. Either mismatch hard-fails CI. ## Cleanup done Running the new checks surfaced: - 5 dead backend keys (`notifications.task.comment.mentioned_message`, `notifications.task.mentioned.message`, and three `notifications.common.actions.assigned_*`) — removed from `pkg/i18n/lang/en.json`. - 47 dead frontend keys across filters, editor toolbar, misc, task, admin overview, migration, and auth namespaces — removed from `frontend/src/i18n/lang/en.json`. - One bug: `i18n.T("notifications.task.overdue.overdue", ...)` in `pkg/models/notifications.go` was missing its `lang` argument, so the key was being passed as the language code. Fixed. The sibling language files under `pkg/i18n/lang/` and `frontend/src/i18n/lang/` will be reconciled on the next Crowdin sync. --- <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-04-23 09:25:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#10118