Skip to content

fix: translate SMART attribute names in health check dialog - #255

Draft
wangrong1069 wants to merge 1 commit into
linuxdeepin:masterfrom
wangrong1069:agent/agent/4d35c4f5e0fe
Draft

wangrong1069 wants to merge 1 commit into
linuxdeepin:masterfrom
wangrong1069:agent/agent/4d35c4f5e0fe

Conversation

@wangrong1069

@wangrong1069 wangrong1069 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Fix: SMART attribute names not translated in health check dialog

Problem

In the disk health detection dialog, SMART attribute names (e.g., "Critical Warning", "Temperature", "Available Spare") are displayed as English raw values without translation, while all other UI elements are properly localized to Chinese.

Root Cause

diskhealthdetectiondialog.cpp line 296 creates QStandardItem(hardDiskStatusInfo.m_attributeName) without calling tr(). The attribute names come from smartctl -A output and are passed through the data layer without any translation.

Fix

  • Added a static helper function translateAttributeName() that maps NVMe and common SATA SMART attribute names through DiskHealthDetectionDialog::tr() for localization
  • Unknown/unmapped attribute names fall back to the original English value
  • Updated deepin-diskmanager_zh_CN.ts with 34 new translation entries

Files Changed

  • application/widgets/diskhealthdetectiondialog.cpp — added translation mapping function + call site
  • application/translations/deepin-diskmanager_zh_CN.ts — added 34 translation entries

Safety

  • No changes to data layer, D-Bus, or business logic
  • The m_attributeName == "Temperature" check at line 216 remains unchanged (compares against English original)
  • Low risk: pure display-layer translation mapping

PMS: BUG-360005

Summary by Sourcery

Localize SMART attribute names displayed by the disk health check dialog.

Bug Fixes:

  • Translate supported NVMe and SATA SMART attribute names in the disk health dialog, while preserving original text for unmapped attributes.

Chores:

  • Add Chinese translations for SMART attribute names.

@wangrong1069
wangrong1069 marked this pull request as draft November 6, 2026 11:30
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wangrong1069

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

@sourcery-ai

sourcery-ai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

UI

Translate recognized NVMe and SATA SMART attribute names in the health dialog, while retaining the original value for unknown names, and add the corresponding Simplified Chinese translations.

  • application/translations/deepin-diskmanager_zh_CN.ts L1264-1433
  • application/widgets/diskhealthdetectiondialog.cpp L46-122, L373

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

1. SMART attribute names displayed as English raw values because
   QStandardItem was created with m_attributeName without tr()
2. Add translateAttributeName() to map NVMe and common SATA SMART
   attribute names through tr() with fallback to original English
3. Update zh_CN translation file with 34 new translation entries

Log: Health check dialog now shows SMART attribute names in Chinese
instead of English raw values

Influence:
1. Verify NVMe SSD health check shows Chinese attribute names
2. Verify SATA SSD health check shows Chinese for common attributes
3. Verify unknown attribute names fall back to English without crash

fix: 修复健康检测对话框中SMART属性名未翻译的问题

1. 健康检测对话框中SMART属性名以英文原值显示,因为创建
   QStandardItem时直接使用m_attributeName未经过tr()翻译
2. 新增translateAttributeName()函数,将NVMe和常见SATA的SMART
   属性英文名通过tr()映射为中文,未知属性名回退为原始英文
3. 更新zh_CN翻译文件,新增34条翻译条目

Log: 健康检测对话框中SMART属性名现在显示为中文而非英文原值

Influence:
1. 验证NVMe固态硬盘健康检测显示中文属性名
2. 验证SATA固态硬盘健康检测常见属性显示中文
3. 验证未知属性名回退为英文不会导致崩溃

PMS: BUG-360005
@wangrong1069
wangrong1069 force-pushed the agent/agent/4d35c4f5e0fe branch from 9701ad1 to fdc8b4d Compare November 13, 2026 08:11
@deepin-bot

deepin-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 6.0.29
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #259

@deepin-bot

deepin-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 6.0.30
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #261

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