Skip to content

Translate catalog items using language preferences#93

Merged
samoylenkodmitry merged 3 commits intomainfrom
codex/translate-original-post-in-each-item-viewmodel
Sep 28, 2025
Merged

Translate catalog items using language preferences#93
samoylenkodmitry merged 3 commits intomainfrom
codex/translate-original-post-in-each-item-viewmodel

Conversation

@samoylenkodmitry
Copy link
Owner

Summary

  • translate catalog item summaries according to the active native and learning language selections
  • implement language-aware translation in ArticleRepository with Retrofit translator support and caching
  • update the detail view model and related tests to use the shared language pair and wire settings dependencies

Testing

  • ./gradlew :feature:catalog:impl:testDebugUnitTest :feature:detail:impl:testDebugUnitTest --console=plain

https://chatgpt.com/codex/tasks/task_e_68d825023c008328b7a11ca46a90f49e

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment on lines 84 to +98
return@launch
}

val translation = repo.translate(normalizedWord)?.let(::normalizeTranslation)
val languages = languageState.value ?: return@launch
val translation = repo.translate(

Choose a reason for hiding this comment

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

[P1] Clear translation cache when languages change

The new language-aware translation uses translationCache keyed only by the normalized word, but translate returns cached values before consulting languageState. If the user switches the native/learning language while the detail screen remains alive, the cache still serves translations from the previous language and the ongoing prefetch job keeps populating it with the old pair because nothing observes languageState to reset the cache. This yields incorrect translations until the ViewModel is recreated. Consider clearing the cache (and restarting prefetch) whenever languageState emits a different language pair.

Useful? React with 👍 / 👎.

@github-actions
Copy link

github-actions bot commented Sep 27, 2025

Test Results

0 tests   0 ✅  0s ⏱️
0 suites  0 💤
0 files    0 ❌

Results for commit 1f796a9.

♻️ This comment has been updated with latest results.

@samoylenkodmitry samoylenkodmitry merged commit dbd3f87 into main Sep 28, 2025
1 check passed
@samoylenkodmitry samoylenkodmitry deleted the codex/translate-original-post-in-each-item-viewmodel branch September 28, 2025 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant