Skip to content

fix(i18n): fix Telegram plugin raw keys, UI separator scaling and add ETA format unit tests - #266

Merged
tonhowtf merged 2 commits into
tonhowtf:mainfrom
ManoloZocco:fix/telegram-i18n-qr-screen
Jul 31, 2026
Merged

fix(i18n): fix Telegram plugin raw keys, UI separator scaling and add ETA format unit tests#266
tonhowtf merged 2 commits into
tonhowtf:mainfrom
ManoloZocco:fix/telegram-i18n-qr-screen

Conversation

@ManoloZocco

Copy link
Copy Markdown
Contributor

Summary of Changes

  • Fix Issue fix: Telegram plugin shows raw i18n keys instead of translated text #264: Consolidates duplicate "telegram" root object in en.json that was overwriting 65 translation keys for the Telegram login QR screen and chat view.
  • i18n Sync: Synchronizes missing Telegram translation keys across all 9 supported locale files (el, es, fr, it, ja, pt, ru, zh, zh-TW). Verified with pnpm check:i18n --strict.
  • UI Separator Fix: Renames .separator container to .or-divider in src/routes/telegram/+page.svelte to prevent collision with global primitives.css scaleY(0.5) rule on Retina/High-DPI displays.
  • Unit Tests: Adds src/lib/stores/download-format.ts and src/lib/stores/download-format.test.ts for ETA and download speed formatting tests (11/11 tests passing).

Closes #264

@tonhowtf tonhowtf left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks — the core diagnosis is exactly right, and I appreciate that you verified with check:i18n --strict. I reproduced everything locally: en.json now parses with a single 102-key telegram object, keys.ts matches the generator output byte-for-byte, all 69 tests pass, svelte-check is clean. The .separator collision is also real (primitives.css is global and applies height: 1px + scaleY(0.5) on 2dppx displays to anything with that class), so the rename to .or-divider is the right call.

Two changes before I can merge:

  1. Restore the real translations instead of English placeholders. The 65 keys you re-added to the 9 locale files existed with full translations right up until #197 wiped them — e.g. pt had "qr_title": "Escaneie para entrar", ru had "Сканируйте QR-код для входа". They're all recoverable with git show 9a6abc8e^:src/lib/i18n/<locale>.json, and it's the exact same key set. As it stands the PR regresses 9 languages to English when the translations already exist in history.

  2. Revert the .separator-text restyle. The class rename fixes the bug; the rest (font-size: 11px, font-weight: 600, uppercase, letter-spacing, padding-inline) is a visual redesign that also breaks our convention of using CSS custom properties instead of hardcoded values. Please keep font-size: var(--text-sm); font-weight: 500 as before, and drop margin-block: 4px unless it fixes something concrete.

Smaller notes, non-blocking:

  • The ETA-format extraction + tests are fine work, but they're a third topic in a fix(i18n) PR. I'll take it this time; please split next time.
  • download-format.ts isn't a store — src/lib/ (next to time-ago.ts) is a better home than src/lib/stores/.
  • In the locale files the restored keys sit after the uploader keys, unlike en.json. Harmless, but if you regenerate via scripts/sync-locales.mjs while restoring translations it'll come out consistent.

Happy to merge once the translations are restored and the separator styling is back on tokens.

Address review feedback on tonhowtf#266.

- Restore the 65 telegram keys that existed translated until tonhowtf#197 wiped
  them, recovered from 9a6abc8^ for all 9 non-en locales. The key set is
  identical and the en source text has not drifted, so the restore is
  lossless. Reorder the telegram object to match en.json key order.
- Revert the .separator-text restyle to the previous token-based values.
  The .or-divider rename stays: it is what fixes the collision with the
  global .separator rule in primitives.css.
- Move download-format.ts and its test out of stores/ to src/lib/, next
  to the other pure helpers.
@ManoloZocco

ManoloZocco commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

Sorry for the trouble this PR caused. I should have checked the history before re-adding those keys. Thanks for taking the time to reproduce everything locally and to point me at the exact commit.

Pushed 108afb07 with the two blocking changes.

1. Translations restored. You were right that they were all recoverable — I pulled the 65 keys from 9a6abc8e^ for each of the 9 locales. Two things I checked before trusting the restore:

  • the key set is identical (set(old) - set(branch) is empty), so nothing was dropped or renamed in between;
  • the English source text for those 65 keys has not drifted between 9a6abc8e^ and this branch, so none of the restored translations are stale relative to the current copy.

Some locales show fewer than 65 changed values (59–64) because a handful were already identical — entries like "title": "Telegram" and the phone-number placeholders were never translated in the first place.

I also reordered the telegram object to follow en.json key order, so the restored keys no longer sit after the uploader ones.

2. Separator styling back on tokens. .separator-text is back to font-size: var(--text-sm); font-weight: 500; color: var(--gray), and I dropped margin-block: 4px — it wasn't fixing anything concrete. The .or-divider rename is all that's left, since that's the part that actually fixes the collision.

3. Moved download-format. It's now src/lib/download-format.ts with the test alongside it, matching time-ago.ts and the other pure helpers. Only the re-export path in download-store.svelte.ts changed; the 11 call sites import through it and were untouched.

Verification after the changes:

pnpm check:i18n  → Generated 3866 translation keys — All 9 other locales in sync with en.json
pnpm test        → Test Files 9 passed (9) | Tests 69 passed (69)
pnpm check       → 1367 FILES 0 ERRORS 107 WARNINGS

The warnings are all pre-existing (a11y/CSS under study/*); none are new, and none are on telegram/+page.svelte.

Two small things I wanted to flag rather than guess at:

  • I couldn't find scripts/sync-locales.mjs in the repo — the closest is scripts/generate-i18n-keys.js (pnpm check:i18n), which regenerates keys.ts but doesn't reorder the locale JSON. I did the reordering with a throwaway script instead. If sync-locales.mjs is something you have in flight, happy to redo it that way once it lands.
  • The other 37 telegram keys (the uploader ones from feat: Telegram Direct Uploader & Leech Bot, Dynamic Quality Picker, Merging Phase Badge & System Enhancements #197) are still English in all 9 locales — but they're already English on main, so there's nothing in history to recover and it isn't a regression from this PR. I left them alone to keep this PR focused, but I'm glad to do them in a separate one if it's useful.

And noted on splitting topics — the ETA extraction shouldn't have ridden along in a fix(i18n) PR. I'll keep them separate next time.

@tonhowtf
tonhowtf merged commit d711ee0 into tonhowtf:main Jul 31, 2026
8 checks passed
@tonhowtf

Copy link
Copy Markdown
Owner

Merged. The restored translations check out against the pre-#197 history and the separator fix is down to exactly the class rename — thanks for turning it around fast and for taking the feedback well. Ships in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: Telegram plugin shows raw i18n keys instead of translated text

2 participants