Skip to content

Feat: Add translate for cpu info.#654

Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:develop/eaglefrom
GongHeng2017:202605071526-dev-eagle-feat
May 7, 2026
Merged

Feat: Add translate for cpu info.#654
deepin-bot[bot] merged 1 commit intolinuxdeepin:develop/eaglefrom
GongHeng2017:202605071526-dev-eagle-feat

Conversation

@GongHeng2017
Copy link
Copy Markdown
Contributor

@GongHeng2017 GongHeng2017 commented May 7, 2026

--Add translate for cpu info.

Log: add feature for cpu info show.
Task: https://pms.uniontech.com/task-view-387697.html

Summary by Sourcery

Add CPU information translations and related labels across multiple locales.

New Features:

  • Introduce localized labels for CPU model, vendor, architecture, cores, threads, and cache levels in DeviceGenerator views across supported languages.

Enhancements:

  • Update translation contexts and locations for existing device manager strings to align with recent source code changes.

--Add translate for cpu info.

Log: add feature for cpu info show.
Task: https://pms.uniontech.com/task-view-387697.html
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 7, 2026

Reviewer's Guide

Adds localized translation entries for new CPU information fields emitted by DeviceGenerator across all supported languages, and refreshes line-number metadata for existing messages after source changes.

File-Level Changes

Change Details Files
Add translations for new CPU info labels from DeviceGenerator and refresh translation metadata.
  • Introduced a new DeviceGenerator translation context with keys such as "Model Name", "Vendor ID", "Architecture", "Core(s)", "Thread(s)", and L1/L2/L3 cache labels in all language .ts files, providing locale-appropriate translations where available and marking some as unfinished where translations are pending.
  • Updated existing DeviceCpu-related translations to point to new source line numbers after DeviceCpu.cpp changes, without altering the translated strings.
  • Refreshed Qt translation metadata (location line numbers) for multiple existing contexts (CommonTools, DeviceMonitor, PageDetail, PageDriverControl, PageMultiInfo, DeviceManager, EDIDParser, main, etc.) to reflect recent source reordering, keeping message text intact.
deepin-devicemanager/translations/deepin-devicemanager.ts
deepin-devicemanager/translations/deepin-devicemanager_bo.ts
deepin-devicemanager/translations/deepin-devicemanager_ug.ts
deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts
deepin-devicemanager/translations/deepin-devicemanager_zh_HK.ts
deepin-devicemanager/translations/deepin-devicemanager_zh_TW.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

@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

Git Diff 代码审查报告

1. 总体概述

这是一个针对deepin-devicemanager项目的多语言翻译文件(.ts)的更新diff。主要变化包括:

  • 代码行号调整(多个文件中的行号增加)
  • 新增了DeviceGenerator上下文,包含CPU相关信息的翻译
  • 部分翻译字符串保持未完成状态(type="unfinished")

2. 语法逻辑分析

2.1 代码行号变更

多个文件中的代码行号有统一增加的趋势,例如:

  • commontools.cpp 从99行变为101行
  • DeviceCpu.cpp 从185行变为189行
  • PageDriverControl.cpp 从97行变为98行

分析:这些行号变更表明源代码文件中添加了新的代码行,导致后续代码行号后移。这是正常的开发过程,但需要确认:

  • 新增的代码行是否与翻译变更相关
  • 是否所有相关翻译都已正确更新

2.2 新增DeviceGenerator上下文

新增了DeviceGenerator上下文,包含以下翻译项:

<context>
    <name>DeviceGenerator</name>
    <message>
        <location filename="../src/GenerateDevice/DeviceGenerator.cpp" line="1269"/>
        <source>Model Name</source>
        <translation type="unfinished"></translation>
    </message>
    <!-- 其他类似条目 -->
</context>

分析:这是一个新增的功能模块,用于显示CPU相关信息。翻译项包括:

  • Model Name (型号名称)
  • Vendor ID (供应商ID)
  • Architecture (架构)
  • Core(s) (核心数)
  • Thread(s) (线程数)
  • L1d cache (L1数据缓存)
  • L1i cache (L1指令缓存)
  • L2 cache (L2缓存)
  • L3 cache (L3缓存)

3. 代码质量评估

3.1 翻译完整性

  • 英文版本(deepin-devicemanager.ts)中,所有新增的DeviceGenerator翻译项都标记为type="unfinished"
  • 中文简体版本(deepin-devicemanager_zh_CN.ts)已完成所有翻译
  • 藏文(deepin-devicemanager_bo.ts)、维吾尔文(deepin-devicemanager_ug.ts)和繁体中文版本(deepin-devicemanager_zh_TW.ts)也已完成翻译
  • 繁体中文香港版本(deepin-devicemanager_zh_HK.ts)部分翻译未完成

建议

  1. 确保所有语言版本的翻译保持一致
  2. 对于未完成的翻译项(type="unfinished"),应尽快完成翻译

3.2 翻译一致性

在不同语言版本中,相同术语的翻译存在一些差异:

例如"Core(s)"的翻译:

  • 英文:Core(s)
  • 中文简体:核
  • 藏文:ལྟེ་བ།
  • 维吾尔文:يادرو
  • 繁体中文:核

分析:这些翻译在各自的语境中都是合理的,但建议:

  1. 建立术语表,确保同一术语在不同上下文中翻译一致
  2. 对于技术术语,考虑是否需要保留英文原文或提供标准翻译

3.3 代码格式

所有翻译文件遵循Qt Linguist的TS文件格式,格式规范,结构清晰。

4. 性能考虑

翻译文件本身不会直接影响程序性能,但以下几点值得注意:

  1. 文件大小:新增的翻译项会增加翻译文件的大小,但影响微乎其微
  2. 加载时间:翻译文件通常在程序启动时加载,新增项不会显著影响加载时间
  3. 内存使用:翻译项会占用少量内存,但同样影响很小

5. 安全性评估

翻译文件本身不包含可执行代码,因此不会直接引入安全风险。但需要注意:

  1. 输入验证:确保程序正确处理翻译字符串,避免格式化字符串漏洞
  2. XSS风险:如果翻译内容用于Web界面,需确保正确转义
  3. 注入攻击:避免将翻译内容直接用于SQL查询或命令执行

6. 改进建议

  1. 翻译完整性

    • 完成所有语言版本的未完成翻译项
    • 特别是英文版本中的DeviceGenerator部分
  2. 术语一致性

    • 建立术语表,确保同一术语在不同上下文中翻译一致
    • 特别是技术术语如"Core(s)"、"cache"等
  3. 翻译质量

    • 检查翻译是否符合目标语言的习惯表达
    • 考虑技术术语是否需要保留英文原文
  4. 代码维护

    • 确保代码行号变更与实际代码变更同步
    • 考虑使用自动化工具同步翻译文件与源代码
  5. 文档更新

    • 更新相关文档,说明新增的DeviceGenerator功能
    • 为翻译人员提供上下文信息,确保翻译准确

7. 结论

本次diff主要是对翻译文件的更新,包括代码行号调整和新增DeviceGenerator上下文的翻译。整体上,翻译文件格式规范,结构清晰。主要需要关注的是完成所有语言版本的翻译,确保术语一致性,以及保持翻译文件与源代码的同步。

没有发现明显的语法错误、性能问题或安全风险。建议按照上述改进建议进一步完善翻译工作。

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • In several locales the newly added DeviceGenerator strings are left with type="unfinished" or differ in terminology from the existing DeviceCpu strings (e.g., Core(s)), which can lead to inconsistent UI; consider aligning the translations and removing the unfinished markers where appropriate.
  • Since you've introduced a new DeviceGenerator context and CPU info labels, double-check that their wording matches the existing CPU-related labels (e.g., for cores and threads) so users see consistent terminology across all CPU-related views.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In several locales the newly added `DeviceGenerator` strings are left with `type="unfinished"` or differ in terminology from the existing `DeviceCpu` strings (e.g., `Core(s)`), which can lead to inconsistent UI; consider aligning the translations and removing the unfinished markers where appropriate.
- Since you've introduced a new `DeviceGenerator` context and CPU info labels, double-check that their wording matches the existing CPU-related labels (e.g., for cores and threads) so users see consistent terminology across all CPU-related views.

## Individual Comments

### Comment 1
<location path="deepin-devicemanager/translations/deepin-devicemanager_ug.ts" line_range="2371-2303" />
<code_context>
     <message>
-        <location filename="../src/Page/PageDriverControl.cpp" line="209"/>
+        <location filename="../src/Page/PageDriverControl.cpp" line="210"/>
         <source>Previous</source>
         <comment>button</comment>
         <translation>Previous</translation>
</code_context>
<issue_to_address>
**issue (bug_risk):** The Uyghur translation for "Previous" is the same as "Next", which can confuse users.

Please update the Uyghur translation for this string to a word meaning “previous/back” (for example, an equivalent of “ئالدىنقى”) so it is clearly distinct from the “Next” label.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread deepin-devicemanager/translations/deepin-devicemanager_ug.ts
@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: GongHeng2017, max-lvs

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

@GongHeng2017
Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot
Copy link
Copy Markdown
Contributor

deepin-bot Bot commented May 7, 2026

This pr force merged! (status: unstable)

@deepin-bot deepin-bot Bot merged commit 1da0828 into linuxdeepin:develop/eagle May 7, 2026
20 of 23 checks passed
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