Skip to content

fix(cjk): reapply engine locale after session destroy or engine reload - #844

Merged
LeanBitLab merged 1 commit into
mainfrom
fix/cjk-locale-reset
Nov 16, 2026
Merged

LeanBitLab merged 1 commit into
mainfrom
fix/cjk-locale-reset

Conversation

@LeanBitLab

Copy link
Copy Markdown
Owner

Problem

Japanese input falls back to Chinese Pinyin after switching apps (reported on a physical keyboard). Restarting the keyboard or reinstalling the plugin fixes it only temporarily.

Cause

CjkInputManager caches the last locale sent to the engine (activeLocale) and only calls setLocale when it changes. destroySession() (called from onFinishInputView on app switch) and engine reloads reset the engine to its default locale (zh), but the cache still says ja, so the locale is never re-sent.

Fix

  • Clear activeLocale after destroySession() in onFinishInputView.
  • Track the engine instance the locale was applied to and re-send it if the instance changes.

Notes

  • Compiles with :app:compileStandardDebugKotlin; not yet tested on device.
  • The Ctrl+Space toolbar part of the report is not addressed here (needs reporter's toolbar settings and logcat).

CjkInputManager cached the last locale sent to the engine and skipped
setLocale when unchanged. destroySession() on finishing the input view
(app switch) and engine reloads reset the engine to its default locale,
so Japanese input fell back to Chinese Pinyin until the keyboard was
restarted. Clear the cache on finish and track the engine instance.
@LeanBitLab
LeanBitLab merged commit 75f0757 into main Nov 16, 2026
1 check passed
@LeanBitLab
LeanBitLab deleted the fix/cjk-locale-reset branch November 16, 2026 06:37
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.

1 participant