Translate catalog items using language preferences#93
Conversation
There was a problem hiding this comment.
💡 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
| return@launch | ||
| } | ||
|
|
||
| val translation = repo.translate(normalizedWord)?.let(::normalizeTranslation) | ||
| val languages = languageState.value ?: return@launch | ||
| val translation = repo.translate( |
There was a problem hiding this comment.
[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 👍 / 👎.
Test Results0 tests 0 ✅ 0s ⏱️ Results for commit 1f796a9. ♻️ This comment has been updated with latest results. |
Summary
ArticleRepositorywith Retrofit translator support and cachingTesting
https://chatgpt.com/codex/tasks/task_e_68d825023c008328b7a11ca46a90f49e