Skip to content

Respect inline translate style for single-message Translate and preserve link entities#12

Merged
Rocket-Space merged 1 commit intomasterfrom
codex/fix-translation-link-issue-in-chat
Feb 24, 2026
Merged

Respect inline translate style for single-message Translate and preserve link entities#12
Rocket-Space merged 1 commit intomasterfrom
codex/fix-translation-link-issue-in-chat

Conversation

@Rocket-Space
Copy link
Owner

Motivation

  • Single-message Translate menu still opened the popup dialog even when the translator style was set to On Message, causing unexpected UI behavior.
  • Translating via the popup caused loss of user-created text links/entities; the inline translation pipeline already masks and restores entities.

Description

  • Added import of TranslationHelper and a new helper method tryTranslateMessageInline(MessageObject, String) in ChatActivity that invokes TranslationHelper.translateMessage(...) when SpaceGramConfig.translateStyle == 0 and a non-Telegram provider is selected.
  • Updated the three single-message Translate entry points in ChatActivity to call tryTranslateMessageInline(...) first and only fall back to TranslateAlert2.showAlert(...) when inline translation is not applicable.
  • This reuses the existing inline masking/restoring logic to preserve MessageEntity links when translating on-message.
  • Modified file: TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java.

Testing

  • Attempted to compile Java with ./gradlew -q :TMessagesProj:compileDebugJavaWithJavac, but the local environment failed with a JDK/Gradle mismatch error (Unsupported class file major version 69), so a successful build could not be validated locally.
  • Performed local code inspection and search (rg/sed) to verify the new callsites and the presence of the new helper method; no runtime tests were executed due to the environment compile failure.

Codex Task

@Rocket-Space Rocket-Space merged commit 7edc4c1 into master Feb 24, 2026
1 check passed
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