Skip to content

Fix tooltip translation through IMGUI hooks - #131

Merged
ManlyMarco merged 1 commit into
BepInEx:masterfrom
angel12538:fix/translate-setting-tooltips
Oct 19, 2026
Merged

ManlyMarco merged 1 commit into
BepInEx:masterfrom
angel12538:fix/translate-setting-tooltips

Conversation

@angel12538

@angel12538 angel12538 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Tooltip descriptions bypass XUnity.AutoTranslator's IMGUI hooks because DrawTooltip renders them directly with GUIStyle.Draw. Cached translations therefore remain unapplied, as reported in #130.

Render tooltips with GUI.Label so they use the normal IMGUI translation path, and reuse ImguiUtils.Content to retain the translated text between repaints. The next repaint then calculates the tooltip height from the translated content, using the same mechanism already used by the other translated controls. This adds no translator dependency.

Closes #130.

Validation:

  • dotnet restore ConfigurationManager.sln and dotnet build ConfigurationManager.sln --no-restore --configuration Release: Mono (net35) and IL2CPP (net6.0) build successfully.
  • In-game regression checks in Koikatsu Sunshine / Unity 2019.4.9f1 with XUnity.AutoTranslator 5.6.3.1 and EnableIMGUI=True, with the standalone compatibility patch disabled: the unmodified upstream build reproduces both cached-translation failures; this change passes long translated text and multiline text, including translated tooltip height on subsequent repaints.
  • Identity translations and empty tooltips retain their expected behavior.
  • Independent uncached-text in-game check with the standalone compatibility patch absent, the existing DeepSeekTranslate endpoint, and FromLanguage=auto / Language=zh: new single-line and multiline tooltips initially miss the cache, enter normal XUnity translation jobs, complete and render in Chinese with correct height and preserved paragraph breaks, and are written to the generated translation file. Recreating their GUIContent then reuses cached translations without new job-creation calls. The probe only observes the normal GUI path and does not submit translations itself.
  • IL2CPP was compile-tested only. Existing dependency-resolution and compiler warnings remain.

Render tooltips with GUI.Label and retain their GUIContent so IMGUI translators can update the text and subsequent repaints measure the translated height.
@ManlyMarco
ManlyMarco merged commit 46a4fb7 into BepInEx:master Oct 19, 2026
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.

Tooltip descriptions remain untranslated despite existing XUnity.AutoTranslator translation entries

2 participants