Skip to content

Add ML Kit translation support for post cards and post detail views#68

Merged
malkoG merged 1 commit intohackers-pub:mainfrom
nove-b:feature/add-mlkit-translation-for-posts
Mar 24, 2026
Merged

Add ML Kit translation support for post cards and post detail views#68
malkoG merged 1 commit intohackers-pub:mainfrom
nove-b:feature/add-mlkit-translation-for-posts

Conversation

@nove-b
Copy link
Copy Markdown
Contributor

@nove-b nove-b commented Mar 22, 2026

Summary

This PR adds ML Kit-based translation support for posts across the app.

Users can now translate post content from both timeline post cards and post detail screens, and toggle back to the original text after translation.

Changes

  • add ML Kit Translate and Language ID dependencies
  • add coroutine Play Services integration for await()
  • add translation-related string resources
  • add translate action to the post card engagement bar
  • add translate action to the post detail action row
  • detect the user's selected app/device language as the translation target
  • show translation loading and error states
  • cache translated text in UI state for quick toggling between translated and original content

Implementation Notes

  • post HTML is converted to plain text before translation
  • the source language is detected with ML Kit Language Identification
  • translation models are downloaded on demand via ML Kit
  • if the detected source language matches the target language, the original text is shown

Tested

  • built the app successfully with ./gradlew assembleDebug
  • verified the translation UI is available on both post cards and post detail screens

Notes

  • translated content is currently displayed as plain text, not re-rendered as HTML
  • links and mentions in translated output are not preserved as interactive elements

@malkoG
Copy link
Copy Markdown
Collaborator

malkoG commented Mar 24, 2026

Thansk for your contribution!

@malkoG malkoG merged commit d222c39 into hackers-pub:main Mar 24, 2026
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.

2 participants