Skip to content

feat: improve DeepLX translation, rich messages, and locale handling - #104

Merged
NextAlone merged 5 commits into
NextAlone:mainfrom
d9k6s:codex/upstream-translation-improvements
Sep 30, 2026
Merged

NextAlone merged 5 commits into
NextAlone:mainfrom
d9k6s:codex/upstream-translation-improvements

Conversation

@d9k6s

@d9k6s d9k6s commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • improve DeepLX long-message segmentation while preserving supported formatting and protected entities
  • add Rich Message text extraction and translation, and expose the translation action when a rich message contains translatable text
  • normalize every CharSequence to plain text at the shared translator boundary before provider dispatch and cache lookup, including SpannableStringBuilder inputs from bot information cards
  • keep cancellation semantics intact and route provider/input failures through the existing translation error callback instead of crashing the main thread
  • isolate automatic translation settings per dialog and topic, migrate legacy positive chat keys, and resolve effective settings in the order topic override -> parent dialog -> global default
  • complete Traditional Chinese resources and map official Hant/Hans language packs to the correct Android resource locale
  • add lightweight regression coverage for locale resolution, dialog/topic inheritance, legacy-key migration, and Rich Message extraction

Follow-up update

This branch now includes the latest upstream/main (b5c427cecccb2391f3054cc8d5bceb6bafc01059) and the fixes developed after the original draft was opened:

  • support non-String CharSequence translation inputs without Unsupported translation query crashes
  • make topics without an explicit override inherit the parent group setting before falling back to the global setting
  • keep an explicit topic enable/disable value at the highest priority

Validation

  • :TMessagesProj:compileDebugJavaWithJavac — BUILD SUCCESSFUL with Java 17 / Gradle 9
  • LanguageResourceLocaleTest — passed
  • AutoTranslateConfigKeyTest — passed
  • RichMessageTextProcessorTest — passed
  • modified locale XML files parsed successfully
  • conflict-marker scan and git diff --check — clean
  • all four PR commits have valid GPG signatures

Scope note

The PR remains limited to 22 application source, resource, and regression-test files. Fork-only automation, including .github/workflows/test-apk.yml and .github/scripts/sync-dev-to-main.ps1, is intentionally excluded.

完整整合 DeepLX 長訊息分段、格式保留與 Rich Message 翻譯,並修正翻譯按鈕的顯示條件。

將自動翻譯設定改為聊天室與 Topic 各自獨立,加入舊版設定遷移,避免不同對話互相污染。

補齊繁體中文資源與官方 Hant/Hans 語言包映射,並新增語系、自動翻譯鍵與 Rich Message 的輕量回歸測試。
@d9k6s
d9k6s marked this pull request as ready for review August 20, 2026 17:38
@d9k6s d9k6s closed this Aug 20, 2026
@d9k6s
d9k6s deleted the codex/upstream-translation-improvements branch August 20, 2026 18:04
@d9k6s
d9k6s restored the codex/upstream-translation-improvements branch August 20, 2026 19:40
@d9k6s d9k6s reopened this Aug 20, 2026
@d9k6s
d9k6s marked this pull request as draft August 23, 2026 10:53
d9k6s added 3 commits August 23, 2026 19:01
整合 NextAlone/Nnngram 最新 main 的除錯設定入口與相關設定輔助程式,讓 PR NextAlone#104 建立在目前上游程式碼之上。

保留 PR 原有翻譯與語系修改,且不納入 fork 專用的 Build Test APK 工作流程。
將 CharSequence 輸入正規化為純文字後再交給翻譯提供者與快取,支援機器人資訊卡傳入的 SpannableStringBuilder。

在翻譯 coroutine 邊界攔截非取消例外並交由既有錯誤處理流程呈現,避免不支援的輸入或提供者例外導致主執行緒崩潰。
讓未設定獨立覆寫的話題依序繼承群組與全域自動翻譯設定,並保留話題明確啟用或停用的最高優先權。

補充父群組設定鍵與有效值解析測試,涵蓋話題覆寫、群組繼承及全域回退。
@d9k6s
d9k6s marked this pull request as ready for review August 23, 2026 16:03
- Keep TL_iv class names and public fields in R8. RichMessageTextProcessor
  walks rich messages by class name and reflection, so minified release
  builds found no translatable text and rich-message translation never ran.
- Let the legacy positive chat key win the one-time auto-translate migration.
  Older builds only read that key; the signed key written by the in-chat
  menu was never read, so preferring it silently flipped the effective
  per-chat setting on upgrade.
- Restore each chunk's leading/trailing whitespace after DeepLX translation.
  DeepL trims requests, so messages longer than deepLxMaxCharacters were
  joined without the spaces at chunk boundaries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NextAlone
NextAlone merged commit 506efdc into NextAlone:main Sep 30, 2026
@d9k6s
d9k6s deleted the codex/upstream-translation-improvements branch October 9, 2026 19:45
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