Skip to content

Translate remaining hardcoded aria-labels - #444

Merged
NovaCode37 merged 1 commit into
NovaCode37:mainfrom
Inbakumar17:fix/translate-aria-labels
Oct 1, 2026
Merged

NovaCode37 merged 1 commit into
NovaCode37:mainfrom
Inbakumar17:fix/translate-aria-labels

Conversation

@Inbakumar17

Copy link
Copy Markdown
Contributor

Moves the 18 hardcoded aria-labels in Topbar.tsx, Sidebar.tsx and ScanResults.tsx to the translation function, so screen readers read them in the selected UI language.

  • Reused existing keys where the English text already matched (topbar.toggleTheme, topbar.apiDocs, watchlist.title, common.backToTop)
  • Added 14 new keys to messages/en.json (topbar, sidebar, results)
  • In ScanResults, used i18n(...) since t is aliased to i18n in that component

Verified:

  • grep -rn 'aria-label="' frontend/src returns nothing
  • npm run build passes

Note: extension/popup.html still has one hardcoded aria-label, but it's outside frontend/src, so I left it out of scope.

Closes #436

@github-actions

Copy link
Copy Markdown

Thanks for the first pull request here. CI needs a maintainer to approve the run before it starts, so it may sit for a bit before anything happens. pytest tests/ -q passing is the main thing I look at.

@github-actions github-actions Bot added the javascript Pull requests that update javascript code label Sep 30, 2026
@NovaCode37

Copy link
Copy Markdown
Owner

Thanks, this is clean: the keys are namespaced where they belong and the diff in en.json only adds what it needs.

CI fails on one thing, and it is my fault, not yours. The issue said other languages fall back to English, so en.json was enough. That is wrong: frontend/scripts/test-i18n-keys.mjs requires every locale to have exactly the same keys, and it fails the build otherwise. I have fixed the issue text.

What is left is adding the same 14 keys to the other nine files in frontend/src/messages/ (ru, de, fr, es, it, pt, pl, zh, tr), in the same places you put them in en.json. Real translations where you can, the English text where you cannot, both pass. Please edit the files by hand rather than re-saving them through a JSON library, so the diff stays small.

cd frontend && npm run test:i18n tells you when it is right. Once that passes I will merge.

@NovaCode37 NovaCode37 mentioned this pull request Oct 1, 2026
2 of 6 tasks
@NovaCode37

Copy link
Copy Markdown
Owner

One update since my last comment: #439 has merged and it added some of the same keys under topbar (starOnGithub, reportIssue, watchlists, getFirefoxExtension), so this now conflicts. When you rebase on main, reuse those for the aria-labels where the text is the same instead of adding them again, and add only the keys that are still missing, in all ten locales. npm run test:i18n will confirm it lines up.

@Inbakumar17
Inbakumar17 force-pushed the fix/translate-aria-labels branch from 9a99daa to 2f18c75 Compare October 1, 2026 15:36
@Inbakumar17

Copy link
Copy Markdown
Contributor Author

Rebased on main. The aria-labels now reuse the keys from #439 (topbar.watchlists, getFirefoxExtension, reportIssue, starOnGithub, plus results.json.copyRawJson), and the 10 remaining keys are added to all ten locales. npm run test:i18n passes. The non-English strings are best-effort translations, so happy to change any a native speaker flags.

@NovaCode37
NovaCode37 merged commit 9290cff into NovaCode37:main Oct 1, 2026
8 checks passed
@NovaCode37 NovaCode37 added the hacktoberfest-accepted Counts toward Hacktoberfest label Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted Counts toward Hacktoberfest javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Translate the 18 aria-labels that are still hardcoded in English

2 participants