sone icon indicating copy to clipboard operation
sone copied to clipboard

Add i18n support (starting with Polish) + language switcher

Open olo81 opened this issue 1 month ago • 1 comments

Summary

I'd like to contribute localization support to SONE. As a first step I'd add the i18n infrastructure plus a complete Polish translation, with English remaining the source of truth and the fallback for everything untranslated. Once the framework is in place, other languages can be added the same way.

Why

  • SONE currently has no localization layer — all user-facing strings are hardcoded in English across roughly 120 React components (≈2,200 string occurrences: JSX text, aria-label/title/placeholder attributes, toasts, error messages).
  • A language setting is a common expectation for desktop apps, and TIDAL itself is localized; this makes SONE accessible to non-English-speaking users.

Proposed approach

  • Library: react-i18next (mature, standard tooling) — or, if you prefer to keep dependencies minimal, a small custom hook over a typed dictionary. I'm happy to go with whichever you prefer; my default recommendation is react-i18next.
  • Language model: English stays the fallback locale, so untranslated keys still render English — the app can be translated incrementally without ever showing empty strings.
  • Detection & override: detect the system locale on first launch, store the choice in settings (localStorage, same pattern as existing UI prefs), expose a dropdown in Settings → General.
  • Pluralization: Polish needs proper plural rules (e.g. "2 utwory" vs "5 utworów"). i18next JSON-v4 plurals handle this natively; with a custom solution I'd implement the equivalent.
  • Tests: existing vitest suites assert on English strings (~214 assertions), so the test environment would stay pinned to English — no test churn in the i18n PRs.

Rollout plan (small, reviewable PRs)

  1. PR 1 — infrastructure: i18n setup, typed dictionaries (en + pl), language detection + Settings dropdown, plus translation of a few high-visibility screens (Login, Sidebar, PlayerBar) as a proof of concept.
  2. PR 2+ — batches by area: Home/cards/context menus → album/playlist/artist/search → Settings tabs → modals/toasts/errors.
  3. Final pass: consistency of terminology, plural forms, string lengths in the UI.

Questions for you

  1. Do you have any preference between react-i18next and a zero-dependency solution?
  2. Key naming conventions — flat keys, nested by screen, or your own scheme?
  3. Any UI constraints I should know (e.g. text length limits in the player bar)?
  4. Would you prefer a draft PR alongside this issue, or discussion first?

Note

This would be an AI-assisted contribution (drafted and translated with AI tooling) — per the README I'd make sure it's manually reviewed and tested before submitting each PR.

Happy to adjust anything — thanks for considering it!

olo81 avatar Nov 01 '26 16:11 olo81

Hi @olo81, this plan looks solid. If @lullabyX says yes, here's something that could take most of the manual work out of the extraction.

I'm building localize.dev, and I ran its check on main. It finds 892 strings to move in 66 files: JSX text, aria-label/title/placeholder, and toasts, with the biggest groups in components/settings (174) and Login.tsx (100). It moves them into en.json with readable keys, rewrites the components to use react-i18next's t(), and turns {count}-style text into interpolation. English stays the fallback, as you planned. It can do one folder at a time, so the first PR could be settings plus the switcher, with your Polish for that part.

If that's useful, run npx localize-dev run on a branch, or I can do it and hand you the branch. Either way the Polish wording stays yours.

ufortstephen avatar Nov 10 '26 18:11 ufortstephen