Skip to content

Add on-device translation to feed posts#87

Merged
barrydeen merged 1 commit intomainfrom
feat/on-device-translation
Feb 28, 2026
Merged

Add on-device translation to feed posts#87
barrydeen merged 1 commit intomainfrom
feat/on-device-translation

Conversation

@barrydeen
Copy link
Copy Markdown
Owner

Summary

  • Adds a "Translate" option to the 3-dot overflow menu on every post, using Google ML Kit for on-device translation
  • Detects source language automatically, downloads translation models on first use (~30MB per language pair), works offline after that
  • Displays translated text inline below the original content with a "Translated from {language}" label
  • Menu toggles between "Translate" / "Show Original" / "Show Translation" once translated, shows "Same Language" when source matches device locale
  • Translation state cached by event ID via TranslationRepository following the existing Nip05Repository version-counter pattern

Test plan

  • Build succeeds with ./gradlew assembleDebug
  • Open feed with foreign-language posts, tap 3-dot menu → "Translate"
  • Verify progress states show inline (detecting language → downloading model → translating)
  • Translated text appears below original with "Translated from {language}" header
  • Menu changes to "Show Original" after translation; toggling hides/shows translation
  • Same-language posts show disabled "Same Language" menu item
  • Translation persists when scrolling away and back
  • Translation works on all screens: feed, thread, profile, notifications, search, hashtag feed, bookmark sets

Use Google ML Kit for on-device translation with no API keys required.
Adds a "Translate" option to the post overflow menu that detects the
source language, downloads the model if needed, and displays the
translated text inline below the original content.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@barrydeen barrydeen merged commit 5712829 into main Feb 28, 2026
@barrydeen barrydeen deleted the feat/on-device-translation branch March 4, 2026 01:28
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.

1 participant