Skip to content

Add message translation caching - #8797

Open
Vespe-r wants to merge 1 commit into
CCBlueX:nextgenfrom
Vespe-r:feat(translation)/cache
Open

Add message translation caching#8797
Vespe-r wants to merge 1 commit into
CCBlueX:nextgenfrom
Vespe-r:feat(translation)/cache

Conversation

@Vespe-r

@Vespe-r Vespe-r commented Aug 7, 2026

Copy link
Copy Markdown

Caches message translations.

@liquidbounce-support-bot

Copy link
Copy Markdown
Contributor

Thanks for the PR!

One thing that stands out: the cache key is only (source, target, text), so it doesn't include the selected Provider. Switching providers keeps serving entries translated by the previous one — worth adding the provider to the key or clearing the cache on mode change.

No docs impact as far as I can tell, since nothing user-facing changes. A maintainer will do the actual review.


🤖 Automated support reply — a human maintainer will review if this doesn't help.


object GlobalSettingsAutoTranslate : ValueGroup(name = "AutoTranslate"), TranslatorApi, EventListener {

private val cache = LruCache<TranslationKey, TranslationResult>(10_000)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

10_000 is incorrect. Should be power of 2. You can probably use Guava's cache.

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