fix: Change the translation language of the application in dock#1100
Conversation
Reviewer's Guide by SourceryThis pull request introduces a fallback mechanism for retrieving localized names within the Sequence diagram for localized name retrievalsequenceDiagram
participant DesktopFileAMParser
participant QLocale
participant ApplicationInterface
DesktopFileAMParser->>QLocale: system().name()
QLocale-->>DesktopFileAMParser: currentLanguageCode
DesktopFileAMParser->>ApplicationInterface: name()
ApplicationInterface-->>DesktopFileAMParser: names
DesktopFileAMParser->>DesktopFileAMParser: getLocaleName(currentLanguageCode, names)
alt currentLanguageCode contains country code AND names does not contain currentLanguageCode
DesktopFileAMParser->>DesktopFileAMParser: prefix = currentLanguageCode.split('_')[0]
alt names contains prefix
DesktopFileAMParser->>ApplicationInterface: names.value(prefix)
ApplicationInterface-->>DesktopFileAMParser: localeName = names.value(prefix)
else names does not contain prefix
DesktopFileAMParser->>ApplicationInterface: names.value(currentLanguageCode)
ApplicationInterface-->>DesktopFileAMParser: localeName = names.value(currentLanguageCode)
end
else currentLanguageCode does not contain country code OR names contains currentLanguageCode
DesktopFileAMParser->>ApplicationInterface: names.value(currentLanguageCode)
ApplicationInterface-->>DesktopFileAMParser: localeName = names.value(currentLanguageCode)
end
DesktopFileAMParser-->>DesktopFileAMParser: return localeName
alt localeName.isEmpty()
DesktopFileAMParser->>ApplicationInterface: names.value(DEFAULT_KEY)
ApplicationInterface-->>DesktopFileAMParser: fallbackName
DesktopFileAMParser-->>DesktopFileAMParser: m_name = fallbackName
else localeName is not empty
DesktopFileAMParser-->>DesktopFileAMParser: m_name = localeName
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @wjyrich - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider extracting the language code retrieval to a separate method for better readability.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
…deepin#1100 Configure name retrieval in three levels fix-Bug-translation
…deepin#1100 Configure name retrieval in three levels fix-Bug-translation
69273dc to
2fe3b01
Compare
…deepin#1100 Configure name retrieval in three levels fix-Bug-translation
2fe3b01 to
569d5f7
Compare
…deepin#1100 Configure name retrieval in three levels fix-Bug-translation
569d5f7 to
a4c9f03
Compare
…deepin#1100 Configure name retrieval in three levels fix-Bug-translation
a4c9f03 to
4ef0d8d
Compare
…deepin#1100 Configure name retrieval in three levels fix-Bug-translation
4ef0d8d to
2cd2584
Compare
…deepin#1100 Configure name retrieval in three levels fix-Bug-translation
2cd2584 to
5e474b8
Compare
| QString DesktopFileAMParser::getLocaleName(const QString& currentLanguageCode, const QStringMap& names) | ||
| { | ||
| auto localeName = names.value(currentLanguageCode); | ||
| if( currentLanguageCode.contains('_') && !(names.contains(currentLanguageCode))) |
There was a problem hiding this comment.
if (currentLanguageCode.contains('_')
Configure name retrieval in three levels fix-Bug-translation
|
CLA Assistant Lite bot: 1 out of 2 committers have signed the CLA. |
…deepin#1100 Configure name retrieval in three levels fix-Bug-translation
6eb57a2 to
e7d9e9d
Compare
deepin pr auto review代码审查意见:
综上所述,建议对代码进行重构,以提高代码质量、可读性和性能。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: wjyrich, yixinshark 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: blocked) |
Configure name retrieval in three levels fix-Bug-translation
Configure name retrieval in three levels
fix-Bug-translation
Summary by Sourcery
Improve language translation handling for desktop file parsing by adding a more flexible language code matching mechanism
Bug Fixes:
Enhancements:
getLocaleName()to provide more robust language code matching for application names, actions, and generic names