Skip to content

fix: add missing tr() sources to .pro and regenerate translations - #693

Merged
pengfeixx merged 1 commit into
linuxdeepin:masterfrom
pengfeixx:agent/agent/3110c90668b3
Oct 27, 2026
Merged

pengfeixx merged 1 commit into
linuxdeepin:masterfrom
pengfeixx:agent/agent/3110c90668b3

Conversation

@pengfeixx

@pengfeixx pengfeixx commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Root Cause

src/deepin-editor.pro SOURCES/HEADERS was missing four files that contain tr() calls:

File tr() strings User-facing text
common/iflytek_ai_assistant.cpp/.h 3 audio device disabled prompts, UOS AI not installed
common/text_file_saver.cpp 9 file-save error prompts (path empty / out of memory / encoding failed …)
editor/markdown/markdownbridge.h 5 collapse/expand/copy code-block prompts
widgets/pathsettintwgt.cpp/.h 3 open/save path settings labels (fixed manually in #694; adding to .pro prevents future lupdate runs from re-marking them vanished)

lupdate never scanned these files, so their existing translations were marked type="vanished" in the .ts catalogs. lrelease drops vanished entries when generating .qm, so at runtime tr() fell back to English. (CMake uses file(GLOB) so compilation was unaffected — only the translation pipeline was broken.)

Fix

  1. Add all four missing file groups to .pro HEADERS/SOURCES (7 lines)
  2. Regenerate deepin-editor.ts, _zh_CN.ts, _zh_HK.ts, _zh_TW.ts via lupdate src/deepin-editor.pro

Per language, 16 vanished entries become active with their existing translations: 3 iflytek + 8 file-save errors + 5 MarkdownBridge.

Verification (done locally with Qt6 lupdate/lrelease)

  • lrelease before: 261 entries in zh_CN .qm, the 16 strings absent; after: 274 entries, all 16 present with correct Chinese (zh_HK/zh_TW likewise)
  • No active→vanished regressions and the stale [QObject] 视图模式 entry (Chinese-literal source from an old iteration, superseded by the active View Mode entry) is removed
  • PathSettingWgt entries (PR fix: restore vanished translations for path settings #694, already merged) stay active after regeneration — no conflict
  • No entries added/removed except Save aborted: editor is closing (newly discovered by lupdate); all remaining unfinished entries are now filled — the new save-abort prompt is translated in zh_CN/zh_HK/zh_TW and the 16 template entries mirror their source strings (275 finished entries per catalog, 0 unfinished / 0 vanished)

Notes

  • Other languages carry the same vanished translations (all 38 catalogs); they recover automatically via the Transifex sync now that the .pro is complete — keeping this PR scoped to zh_CN/zh_HK/zh_TW/template
  • .pro is only consumed by the Qt translation toolchain; CMake build unaffected

PMS: BUG-380741

@sourcery-ai

sourcery-ai Bot commented Oct 27, 2026

Copy link
Copy Markdown

Sorry @pengfeixx, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 11 hours and 5 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Oct 27, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR fixes the Qt translation pipeline by adding the iFlytek assistant files to the qmake SOURCES/HEADERS lists, then regenerating the Chinese catalog so three existing translations are emitted into the runtime .qm instead of falling back to English; the broad location-only catalog changes are generated metadata updates.

File-Level Changes

Change Details Files
Register the iFlytek assistant sources with the qmake translation scan.
  • Add the assistant header to HEADERS and implementation to SOURCES in the .pro file.
  • Keep the application build unchanged because the entries affect the Qt translation toolchain, not the CMake source discovery.
src/deepin-editor.pro
Regenerate Simplified Chinese translation metadata and reactivate the assistant prompts.
  • Convert three iFlytek prompt translations from vanished to active entries with source locations.
  • Update generated source locations throughout the catalog as produced by lupdate.
translations/deepin-editor_zh_CN.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@pengfeixx
pengfeixx force-pushed the agent/agent/3110c90668b3 branch 2 times, most recently from b0fff6a to 161b650 Compare October 27, 2026 05:55
@pengfeixx pengfeixx changed the title fix: add iflytek_ai_assistant to .pro SOURCES fix: add missing tr() sources to .pro and regenerate translations Oct 27, 2026
@pengfeixx
pengfeixx force-pushed the agent/agent/3110c90668b3 branch from 161b650 to 1929dbd Compare October 27, 2026 06:02
1. Root cause: src/deepin-editor.pro SOURCES/HEADERS was missing four
   files containing tr() calls: common/iflytek_ai_assistant.cpp/.h,
   common/text_file_saver.cpp, editor/markdown/markdownbridge.h and
   widgets/pathsettintwgt.cpp/.h. lupdate never scanned them, so their
   existing translations were marked "vanished" in the .ts catalogs and
   lrelease dropped them from .qm; runtime tr() fell back to English
2. Fix: add all missing files to the .pro lists, then regenerate
   deepin-editor.ts / zh_CN / zh_HK / zh_TW via lupdate. Per language
   16 vanished entries become active with their existing translations:
   3 iflytek prompts, 8 file-save error prompts (text_file_saver),
   5 markdown code-block prompts (MarkdownBridge). Also fill all
   remaining unfinished entries: the new "Save aborted: editor is
   closing" prompt in zh_CN/zh_HK/zh_TW and 16 template entries
   (translation mirrors source)
3. Impact: voice read-aloud/dictation prompts, file-save error
   messages and markdown code-block actions now display Chinese
   (Simplified and Traditional); no code logic or build behavior
   changed. Remaining languages recover via the Transifex sync now
   that the .pro is complete. The stale "视图模式" entry (Chinese-literal
   source from an old iteration, superseded by the active "View Mode"
   entry) is removed from all catalogs

Log: Fix English fallback for prompts from files missing in .pro

Influence:
1. Test voice read-aloud/dictation with audio devices disabled
2. Test saving a large file / read-only file to see Chinese error prompts
3. Test markdown code block collapse/expand/copy tooltips
4. Verify settings path labels stay Chinese (PR linuxdeepin#694 not regressed)
5. Verify other translated strings remain correct

fix: 补全 .pro 缺失的翻译源文件并重新生成翻译

1. 根因:src/deepin-editor.pro 的 SOURCES/HEADERS 列表缺少四个含
   tr() 调用的文件:common/iflytek_ai_assistant.cpp/.h、
   common/text_file_saver.cpp、editor/markdown/markdownbridge.h、
   widgets/pathsettintwgt.cpp/.h。lupdate 从未扫描过它们,已有译文
   被标记为 vanished,lrelease 丢弃后 .qm 缺失,运行时 tr() 回退英文
2. 方案:将缺失文件全部补入 .pro,用 lupdate 重新生成
   deepin-editor.ts / zh_CN / zh_HK / zh_TW。每个语言 16 条 vanished
   条目恢复生效并保留原有译文:iflytek 提示 3 条、文件保存错误
   提示 8 条(text_file_saver)、Markdown 代码块操作提示 5 条。
   并补全全部剩余 unfinished 条目:新增的"Save aborted: editor
   is closing"提示(简繁三语)及模板 16 条(译文同源串)
3. 影响:语音朗读/听写提示、文件保存错误提示、Markdown 代码块
   操作文案恢复正常显示中文(简体与繁体),不涉及代码逻辑与
   编译行为。其余语言可经由 Transifex 同步在 .pro 补全后自动恢复。
   "视图模式"为源码中已无调用的死条目(已被生效的
   "View Mode" 条目取代),已从全部目录中删除

Log: 修复 .pro 缺失源文件导致的提示文案回退英文问题

Influence:
1. 测试禁用音频输出/输入设备时的语音朗读与听写提示
2. 测试大文件/只读文件保存失败时的错误提示文案
3. 测试 Markdown 代码块折叠/展开/复制的提示文案
4. 验证设置页打开/保存位置文案仍为中文(不回退 linuxdeepin#694 的修复)
5. 验证其他已翻译文案不受影响

PMS: BUG-380741
@pengfeixx
pengfeixx force-pushed the agent/agent/3110c90668b3 branch from 1929dbd to 033b72a Compare October 27, 2026 06:07
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交目的是将遗漏的源文件添加到 .pro 工程文件中并重新生成翻译文件。变更内容为项目配置文件(.pro)的 HEADERS/SOURCES 列表补全和翻译文件(.ts)的自动重新生成,语法正确、逻辑清晰,无安全漏洞,无性能影响,代码质量良好。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: []


💡 改进建议代码示例


本报告由 AI 代码审查工具自动生成

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lzwind, pengfeixx

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pengfeixx
pengfeixx merged commit 3937fd9 into linuxdeepin:master Oct 27, 2026
17 of 18 checks passed
@pengfeixx
pengfeixx deleted the agent/agent/3110c90668b3 branch October 27, 2026 06:26
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.

3 participants