fix: Fix Control Center jump failure#581
Merged
pengfeixx merged 1 commit intolinuxdeepin:masterfrom Jan 15, 2026
Merged
Conversation
Fix Control Center jump failure Log: Fix Control Center jump failure pms: BUG-346395
deepin pr auto review针对提供的 1. 语法逻辑与代码质量问题 1:硬编码的国际化数据
问题 2:Key 命名规范不一致
问题 3:注释掉的代码
问题 4:翻译内容的准确性
2. 代码性能
3. 代码安全
4. 综合修改建议示例如果必须保留这种结构,建议按以下方式优化代码片段: // 建议将 langCount 定义移至头文件或使用更安全的方式
constexpr int LANG_COUNT = 5;
// 建议使用 QMap 或 QHash,但若必须用数组,请确保 Key 规范化
// 假设顺序为: Key, zh_CN, en_US, zh_HK, zh_TW
QString languageArr[][LANG_COUNT] = {
// dde model
{"controlCenter", "控制中心", "Control Center", "控制中心", "控制中心"}, // 语义化 Key
{"homepageIntro", "首页介绍", "Homepage Introduction", "首頁介紹", "首頁介紹"},
{"authentication", "生物认证", "Biometric Authentication", "生物認證", "生物認證"},
// ... 其他条目 ...
{"mouseAndTouchpad", "鼠标和触控板", "Mouse and Touchpad", "滑鼠和觸控板", "滑鼠和觸控板"},
{"licenseActivator", "授权管理", "Authorization Management", "授權管理", "授權管理"}, // 去除空格
{"langAndFormat", "语言和区域", "Language & Region", "語言和區域", "語言和區域"}
};总结这段代码的主要问题在于维护性和规范性。硬编码的翻译数据不符合现代软件工程的最佳实践,建议优先考虑迁移到 Qt 的标准国际化系统(.ts 文件)。如果暂时无法迁移,请务必规范 Key 的命名(去除空格、统一风格),并考虑使用更灵活的数据结构(如 |
lzwind
approved these changes
Jan 15, 2026
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix Control Center jump failure
Log: Fix Control Center jump failure
pms: BUG-346395