Skip to content

feat: added ability to translate articles with AI service#1072

Merged
spacecowboy merged 35 commits into
spacecowboy:masterfrom
JaredTweed:master
May 7, 2026
Merged

feat: added ability to translate articles with AI service#1072
spacecowboy merged 35 commits into
spacecowboy:masterfrom
JaredTweed:master

Conversation

@JaredTweed

@JaredTweed JaredTweed commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Below are the screenshots associated with the update.

fixes #1070

Screenshot_20260318-114310 Screenshot_20260318-114302 Screenshot_20260318-114222 Screenshot_20260318-114154

@JaredTweed

Copy link
Copy Markdown
Contributor Author

Enabled translation for #1070

@spacecowboy spacecowboy 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.

Tell your AI agent to stop touching comments and debug logging

Comment thread app/src/main/java/com/nononsenseapps/feeder/ui/compose/feed/FeedItemCard.kt Outdated
@spacecowboy

Copy link
Copy Markdown
Owner

Also CI is entirely broken. (you can ignore the apk-jobs, they always fail on PRs)

@JaredTweed

Copy link
Copy Markdown
Contributor Author

Okay, I updated the translation API with your requests, and made some other improvements to make the code cleaner as a whole. Let me know if you would like any other changes. Below are some screenshots from my updates to the UI:

Screenshot_20260319-141810 Screenshot_20260319-141837 Screenshot_20260319-141830

@JaredTweed JaredTweed requested a review from spacecowboy March 19, 2026 19:24
@spacecowboy

Copy link
Copy Markdown
Owner

When you write feed cards in that screenshot, what do you mean?

@JaredTweed

Copy link
Copy Markdown
Contributor Author

When you write feed cards in that screenshot, what do you mean?

It toggles wether the article links are translated by default. Is there a better title you would suggest? As you can see it is translated to English by default here when it is toggled on, but it doesn't translate the previews when toggled off.

Screenshot_20260322-003147 Screenshot_20260322-003203 Screenshot_20260322-003212 Screenshot_20260322-003224

# Conflicts:
#	app/src/main/java/com/nononsenseapps/feeder/archmodel/SettingsStore.kt
#	app/src/main/java/com/nononsenseapps/feeder/model/opml/OPMLImporter.kt
#	app/src/test/java/com/nononsenseapps/feeder/model/opml/OpmlParserTest.kt
#	app/src/test/java/com/nononsenseapps/feeder/model/opml/OpmlWriterKtTest.kt
@JaredTweed

JaredTweed commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

@spacecowboy Is my PR good, or would you like me to change something about it?

@JaredTweed

Copy link
Copy Markdown
Contributor Author

@spacecowboy I removed the google translate API because it is harder to get. So now if you want test it completely, it is completely free. You just login to DeepL to get a free API key.

@spacecowboy spacecowboy 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.

Added inline suggestions to use real ellipsis character.

Also, please have a look at CI results. You have both lint-errors and compilation errors.

fix lint by running ./gradlew ktlintformat

Comment thread app/src/main/res/values/strings.xml Outdated
Comment thread app/src/main/res/values/strings.xml Outdated
Comment thread app/src/main/res/values/strings.xml Outdated
JaredTweed and others added 4 commits April 9, 2026 08:51
@JaredTweed JaredTweed requested a review from spacecowboy April 9, 2026 16:14
@JaredTweed

Copy link
Copy Markdown
Contributor Author

@spacecowboy okay, I made those changes. Let me know what you think!

@JaredTweed

Copy link
Copy Markdown
Contributor Author

@spacecowboy Is there anything I need to change? My code is good as far as I know.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds end-to-end translation support (fixing #1070) by introducing a dedicated “Translation API” configuration (currently DeepL-backed) alongside the existing summary AI integration, wiring the new preferences through settings UI + OPML import/export, and enabling translation of feed cards and full articles.

Changes:

  • Split settings into “Summary API” vs “Translation API”, including provider selection/validation UX and new translation-related toggles.
  • Implement DeepL translation/verification in OpenAIApi, add translation caching + language-detection helpers via TranslationManager and TranslationLanguageUtils.
  • Integrate translation into feed previews and article viewing, and persist/import/export the new settings via OPML.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
app/src/test/java/com/nononsenseapps/feeder/openai/OpenAIApiTest.kt Updates summary tests for new API signature and adds DeepL request/response tests with MockWebServer.
app/src/test/java/com/nononsenseapps/feeder/model/TranslationLanguageUtilsKtTest.kt Adds unit tests for language matching and HTML stripping behavior used by translation detection.
app/src/test/java/com/nononsenseapps/feeder/model/opml/OpmlWriterKtTest.kt Extends OPML writer test expectations to include translation-related settings.
app/src/test/java/com/nononsenseapps/feeder/model/opml/OpmlParserTest.kt Extends OPML parser tests to verify translation settings are read/applied.
app/src/main/res/values/strings.xml Adds new strings for translation UI, provider selection, and settings verification messages.
app/src/main/java/com/nononsenseapps/feeder/ui/compose/settings/SettingsViewModel.kt Adds translation settings/toggles and refactors OpenAI settings event handling to support two sections.
app/src/main/java/com/nononsenseapps/feeder/ui/compose/settings/Settings.kt Wires new view-state fields and renders summary + translation settings sections and translation default switches.
app/src/main/java/com/nononsenseapps/feeder/ui/compose/settings/OpenAISection.kt Adds provider presets, validation UX, and a dedicated translation section UI.
app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/FeedViewModel.kt Adds feed-card translation state + orchestration using TranslationManager.
app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleViewModel.kt Adds article translation state, translation toggle action, and uses translation manager for translated content/TTS.
app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleScreen.kt Adds translate action to the article menu and shows a progress indicator while translating.
app/src/main/java/com/nononsenseapps/feeder/ui/compose/feed/FeedScreen.kt Merges translated feed-card previews into list/grid items and triggers translation when items appear.
app/src/main/java/com/nononsenseapps/feeder/openai/OpenAIApi.kt Adds DeepL translate + verification support, updates summarization signature, and expands language parsing.
app/src/main/java/com/nononsenseapps/feeder/model/TranslationManager.kt New translation manager handling caching, translation execution, and “already in target language” detection.
app/src/main/java/com/nononsenseapps/feeder/model/TranslationLanguageUtils.kt New utilities for language detection preparation and target-language matching logic.
app/src/main/java/com/nononsenseapps/feeder/model/opml/OPMLImporter.kt Imports new translation-related OPML settings into the settings store.
app/src/main/java/com/nononsenseapps/feeder/di/ArchModelModule.kt Registers TranslationManager and updates OpenAIApi DI construction.
app/src/main/java/com/nononsenseapps/feeder/archmodel/SettingsStore.kt Persists translation API settings, preferred translation language, and default translation toggles.
app/src/main/java/com/nononsenseapps/feeder/archmodel/Repository.kt Exposes translation settings/toggles via repository APIs.
app/src/androidTest/java/com/nononsenseapps/feeder/model/opml/OPMLTest.kt Extends instrumentation OPML test data/expectations with translation settings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +253 to +259
val translatedItem = translationManager.translateFeedListItem(item)
val updatedCached =
translationManager.getCachedTranslatedFeedListItem(
item = item,
settings = config.settings,
targetLanguage = config.targetLanguage,
)
@spacecowboy spacecowboy changed the title Enabled translations (to resolve issue #1070) Enabled translations May 6, 2026

@spacecowboy spacecowboy 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.

I think it seems good enough to merge

@spacecowboy spacecowboy changed the title Enabled translations feat: added ability to translate articles using AI service May 7, 2026
@spacecowboy spacecowboy changed the title feat: added ability to translate articles using AI service feat: added ability to translate articles with AI service May 7, 2026
@spacecowboy spacecowboy merged commit 807d041 into spacecowboy:master May 7, 2026
12 checks passed
@spacecowboy

Copy link
Copy Markdown
Owner

Thanks for the @JaredTweed and sorry about the long delayed review

@JaredTweed

Copy link
Copy Markdown
Contributor Author

Thank you!

@Digitalpeer1

Copy link
Copy Markdown

Thanks for making this feature look forward to this in the next build!

@Digitalpeer1

Digitalpeer1 commented May 16, 2026

Copy link
Copy Markdown

Is it possible to do this in a local way DeepL requires API and the option for google is not showing up for me could run a small model something like firefox does? @JaredTweed

EDIT: did some digging and it looks like firefox uses the Bergamot with this behind it tool for their translations here is the how they use it if this is helpfull?

@JaredTweed

Copy link
Copy Markdown
Contributor Author

@Digitalpeer1 Good idea! I will do that!

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.

4 participants