-
Notifications
You must be signed in to change notification settings - Fork 40
Feat: [cpu] Add translate for cpu. #582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: [cpu] Add translate for cpu. #582
Conversation
-- add translate for cpu. Log: add feature Task: https://pms.uniontech.com/task-view-384577.html
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds translation support for the CPU "Max Boost Clock" label by including it in the generic device translation list and making the CPU table header use a non-translated literal for conditional display logic. Class diagram for CPU translation handling changesclassDiagram
class DeviceBaseInfo {
+void generatorTranslate()
}
class DeviceCpu {
-QStringList m_TableHeader
+void loadTableHeader()
}
DeviceCpu --|> DeviceBaseInfo
DeviceBaseInfo : generatorTranslate adds Max_Boost_Clock_translation
DeviceCpu : loadTableHeader uses literal_Max_Boost_Clock_in_header
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review我来帮你分析这个diff修改。这个修改主要涉及两处代码变更,都是关于字符串翻译的处理。
- m_TableHeader.append(tr("Max Boost Clock"));
+ m_TableHeader.append("Max Boost Clock");
<< tr("Processor")
+ << tr("Max Boost Clock");以下是我的分析和建议:
改进建议:
m_TableHeader.append(tr("Max Boost Clock"));
这样的修改将有助于:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- In
DeviceCpu::loadTableHeader,"Max Boost Clock"is now a raw string whileDeviceBaseInfo::generatorTranslateusestr("Max Boost Clock"); consider usingtr()consistently so the displayed header text is actually translated. - Since
"Max Boost Clock"is now used in multiple places, consider extracting it into a shared constant or helper to avoid duplication and keep label changes synchronized across the UI.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `DeviceCpu::loadTableHeader`, `"Max Boost Clock"` is now a raw string while `DeviceBaseInfo::generatorTranslate` uses `tr("Max Boost Clock")`; consider using `tr()` consistently so the displayed header text is actually translated.
- Since `"Max Boost Clock"` is now used in multiple places, consider extracting it into a shared constant or helper to avoid duplication and keep label changes synchronized across the UI.
## Individual Comments
### Comment 1
<location> `deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp:1249` </location>
<code_context>
<< tr("Vendor") \
- << tr("Processor");
+ << tr("Processor") \
+ << tr("Max Boost Clock");
}
</code_context>
<issue_to_address>
**issue (bug_risk):** Check that always adding a translation for "Max Boost Clock" won't misalign any index-based mappings for devices where this column is not present.
In `generatorTranslate()` this translation is always appended, but `DeviceCpu::loadTableHeader()` only adds the "Max Boost Clock" column for `kSpecialCpuType1`. If any code assumes positional alignment between this translation list and the table headers, you could get off‑by‑one or incorrect labels when the column is absent. Consider applying the same condition here, or confirm that consumers don’t rely on strict index matching.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/forcemerge |
|
This pr force merged! (status: unstable) |
7846ad2
into
linuxdeepin:develop/eagle
-- add translate for cpu.
Log: add feature
Task: https://pms.uniontech.com/task-view-384577.html
Summary by Sourcery
Add translation support for the CPU "Max Boost Clock" label and align the CPU table header configuration with the updated translations.
New Features:
Enhancements: