Skip to content

Conversation

@wjyrich
Copy link
Contributor

@wjyrich wjyrich commented Sep 24, 2025

  1. Added translation handling for NotifyItemContent.qml in CMakeLists.txt
  2. Replaced SettingActionButton with AnimationSettingButton for better UX
  3. Added text label "Clear alone" to the close button for accessibility
  4. Anchored close button to the right side for proper layout
  5. Created translation files for 20+ languages including Chinese variants
  6. Pre-filled Chinese translations (zh_CN, zh_HK, zh_TW) while leaving others unfinished

This change enables internationalization support for the notification clear button, making the interface more user-friendly for global users. The button now has proper text labeling and improved positioning.

feat: 为通知清除按钮添加国际化支持

  1. 在 CMakeLists.txt 中添加对 NotifyItemContent.qml 的翻译处理
  2. 将 SettingActionButton 替换为 AnimationSettingButton 以提升用户体验
  3. 为关闭按钮添加"清除单个"文本标签以提高可访问性
  4. 将关闭按钮锚定到右侧以实现正确布局
  5. 创建包含中文变体在内的20多种语言翻译文件
  6. 预填充中文翻译(简体、香港、台湾),其他语言留空待翻译

此更改使通知清除按钮支持国际化,为全球用户提供更友好的界面。按钮现在具有
适当的文本标签和改善的定位。

Pms: BUG-283587

Summary by Sourcery

Add internationalization support for the notification clear button and enhance its layout and UX

New Features:

  • Extract translations from NotifyItemContent.qml via CMake
  • Add 'Clear alone' text label with qsTr for the clear button
  • Provide translation templates for 20+ languages with Chinese variants prefilled

Enhancements:

  • Replace SettingActionButton with AnimationSettingButton for improved UX
  • Anchor the clear button to the right for proper layout and accessibility

Build:

  • Update CMakeLists.txt to handle QML translations for NotifyItemContent.qml

1. Added translation handling for NotifyItemContent.qml in
CMakeLists.txt
2. Replaced SettingActionButton with AnimationSettingButton for better
UX
3. Added text label "Clear alone" to the close button for accessibility
4. Anchored close button to the right side for proper layout
5. Created translation files for 20+ languages including Chinese
variants
6. Pre-filled Chinese translations (zh_CN, zh_HK, zh_TW) while leaving
others unfinished

This change enables internationalization support for the notification
clear button, making the interface more user-friendly for global users.
The button now has proper text labeling and improved positioning.

feat: 为通知清除按钮添加国际化支持

1. 在 CMakeLists.txt 中添加对 NotifyItemContent.qml 的翻译处理
2. 将 SettingActionButton 替换为 AnimationSettingButton 以提升用户体验
3. 为关闭按钮添加"清除单个"文本标签以提高可访问性
4. 将关闭按钮锚定到右侧以实现正确布局
5. 创建包含中文变体在内的20多种语言翻译文件
6. 预填充中文翻译(简体、香港、台湾),其他语言留空待翻译

此更改使通知清除按钮支持国际化,为全球用户提供更友好的界面。按钮现在具有
适当的文本标签和改善的定位。

Pms: BUG-283587
@sourcery-ai
Copy link

sourcery-ai bot commented Sep 24, 2025

Reviewer's Guide

This PR adds internationalization support for the notification clear button by updating the QML component for accessibility and UX, integrating translation handling in the build system, and scaffolding TS files for 20+ languages with prefilled Chinese variants.

Class diagram for updated NotifyItemContent QML component

classDiagram
    class NotifyItemContent {
      +Loader closeBtn
      +AnimationSettingButton replaces SettingActionButton
      +text: qsTr("Clear alone")
      +anchors.right: parent.right
    }
    NotifyItemContent --> AnimationSettingButton
Loading

File-Level Changes

Change Details Files
Enhanced NotifyItemContent QML for i18n and UX improvements
  • Imported notificationcenter module for translation support
  • Anchored close button to parent’s right side
  • Swapped SettingActionButton with AnimationSettingButton
  • Added qsTr("Clear alone") label for accessibility
panels/notification/plugin/NotifyItemContent.qml
Integrated translation handling in build configuration
  • Added ds_handle_package_translation entry for NotifyItemContent.qml
panels/notification/CMakeLists.txt
Created translation scaffolding for 20+ languages
  • Generated TS files for each locale under translations directory
  • Prefilled Chinese (zh_CN, zh_HK, zh_TW) translations, left others unfinished
panels/notification/translations/*.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

Copy link

@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 there - I've reviewed your changes - here's some feedback:

  • Remove the unused import org.deepin.ds.notificationcenter from NotifyItemContent.qml to keep dependencies minimal.
  • Revisit the 'Clear alone' text for clarity—consider renaming it to something like 'Clear notification' or 'Dismiss this' to improve user understanding.
  • Verify that switching to AnimationSettingButton preserves the original focus and hover behaviors of the close button across all notification scenarios.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Remove the unused import org.deepin.ds.notificationcenter from NotifyItemContent.qml to keep dependencies minimal.
- Revisit the 'Clear alone' text for clarity—consider renaming it to something like 'Clear notification' or 'Dismiss this' to improve user understanding.
- Verify that switching to AnimationSettingButton preserves the original focus and hover behaviors of the close button across all notification scenarios.

## Individual Comments

### Comment 1
<location> `panels/notification/plugin/NotifyItemContent.qml:70` </location>
<code_context>
                     id: closeBtn
                     objectName: "closeNotify-" + root.appName
                     icon.name: "clean-alone"
+                    text: qsTr("Clear alone")
                     padding: 2
                     forcusBorderVisible: visualFocus
</code_context>

<issue_to_address>
**suggestion:** Review the phrasing of 'Clear alone' for clarity.

Consider using a more descriptive label, such as 'Clear this notification', to improve clarity unless 'Clear alone' is needed for consistency.

```suggestion
                    text: qsTr("Clear this notification")
```
</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.

anchors.right: parent.right
active: !(root.strongInteractive && root.actions.length > 0) && (root.closeVisible || closePlaceHolder.hovered || activeFocus)
sourceComponent: SettingActionButton {
sourceComponent: AnimationSettingButton {
Copy link
Contributor

@18202781743 18202781743 Sep 24, 2025

Choose a reason for hiding this comment

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

AnimationSettingButton 应该可以移动到plugin中,
center依赖plugin,而不应该plugin依赖center,
这里的清除按钮也要改成这种么,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

是的


install(TARGETS ds-notification-shared DESTINATION "${LIB_INSTALL_DIR}")
ds_install_package(PACKAGE org.deepin.ds.notification TARGET ds-notification)
ds_handle_package_translation(PACKAGE org.deepin.ds.notification QML_FILES ${CMAKE_CURRENT_SOURCE_DIR}/plugin/NotifyItemContent.qml)
Copy link
Contributor

Choose a reason for hiding this comment

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

这里获取所有的文件吧,免得之后要单个加需要翻译的文件,

Copy link
Member

Choose a reason for hiding this comment

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

新资源需要加到 .tx/transifex.yaml

@wjyrich wjyrich closed this Sep 24, 2025
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