Skip to content

chore(transifex): add configuration for power plugin translations#72

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
mhduiy:tr
May 29, 2026
Merged

chore(transifex): add configuration for power plugin translations#72
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
mhduiy:tr

Conversation

@mhduiy
Copy link
Copy Markdown
Contributor

@mhduiy mhduiy commented May 29, 2026

  1. Add Transifex config mapping source translation to language files
  2. Set source language to en_US for plugin-power-session

Log: add transifex.yaml config for power plugin translations

chore(transifex): 为 power 插件添加 Transifex 翻译配置

  1. 添加 Transifex 配置,映射源翻译文件到各语言文件
  2. 设置源语言为 en_US 的 plugin-power-session

Log: 为 power 插件添加 transifex.yaml 翻译配置

Summary by Sourcery

Build:

  • Add Transifex YAML config to map QT power session plugin source translations to per-language files and set the source language to en_US.

1. Add Transifex config mapping source translation to language files
2. Set source language to en_US for plugin-power-session

Log: add transifex.yaml config for power plugin translations

chore(transifex): 为 power 插件添加 Transifex 翻译配置

1. 添加 Transifex 配置,映射源翻译文件到各语言文件
2. 设置源语言为 en_US 的 plugin-power-session

Log: 为 power 插件添加 transifex.yaml 翻译配置
Copy link
Copy Markdown

@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 - I've left some high level feedback:

  • Consider normalizing the indentation under settings: to match the two-space indentation used under filters: to avoid potential YAML parsing or readability issues.
  • Double-check that the translation_files_expression pattern (plugin-power-session_<lang>.ts) aligns with your actual locale naming convention (e.g., en_US, zh_CN) so Transifex maps locales correctly.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider normalizing the indentation under `settings:` to match the two-space indentation used under `filters:` to avoid potential YAML parsing or readability issues.
- Double-check that the `translation_files_expression` pattern (`plugin-power-session_<lang>.ts`) aligns with your actual locale naming convention (e.g., `en_US`, `zh_CN`) so Transifex maps locales correctly.

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.

@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

你好!我是CodeGeeX。我已仔细审查了你提供的 .tx/transifex.yaml 配置文件差分。这是一个用于配置 Transifex(一个本地化/翻译管理平台)与代码仓库同步的 YAML 文件。

总体来说,该配置结构清晰,基本满足了将 Qt 翻译源文件与 Transifex 关联的需求。但在语法逻辑、代码质量、代码性能和代码安全方面,我有一些改进建议:

1. 语法逻辑

  • 缩进对齐问题:在 YAML 文件中,缩进是语法的一部分。filters 下的列表项 - filter_type: file 缩进为 2 个空格,而 settings 的缩进也是 2 个空格,这是正确的。但是列表项内部的 source_filefile_format 等缩进为 4 个空格,而 settings 下的 pr_branch_name 缩进也是 4 个空格。虽然这在语法上是合法的,但建议保持同层级键值对缩进的一致性,避免混淆。
  • 文件格式名称file_format: QT 在较新的 Transifex 配置中通常是合法的,但在某些旧版或特定客户端中,可能需要更具体的格式如 QT_LINGUIST。建议根据你使用的 Transifex 客户端版本确认。

2. 代码质量

  • 硬编码路径source_filetranslation_files_expression 中使用了较长的硬编码相对路径。如果未来项目结构重构,需要手动修改多处。建议在 YAML 中利用锚点或变量来复用路径前缀。
  • 缺少配置隔离:没有为该 filter 指定明确的 name。虽然 Transifex 会自动生成,但赋予一个具有业务语义的名称(如 power-session-translations)有助于在日志和后台中快速定位问题。

3. 代码性能

  • 文件匹配范围translation_files_expression 使用了 <lang> 通配符。这本身是性能最优的写法,因为它精确匹配了特定前缀的 .ts 文件,而不会去扫描目录下其他无关文件(如临时文件)。这部分没有问题,性能表现良好。

4. 代码安全

  • 分支名称随机性pr_branch_name: transifex_update_<br_unique_id> 使用了 <br_unique_id> 宏,这可以防止并发拉取翻译时产生分支冲突,是一个良好的安全与稳定性实践。
  • 潜在路径穿越(低风险):由于配置文件指定了明确的相对路径,且 Transifex 客户端通常会在仓库根目录执行,路径穿越风险极低。但需确保 Transifex 自动提交 PR 时,不会意外覆盖仓库中的其他敏感文件(通常 Transifex 只会修改匹配到的 .ts 文件,风险可控)。

改进后的代码建议

filters:
  - filter_type: file
    name: power-session-translations # 改进:增加具有业务语义的名称,便于管理
    source_file: src/plugin-qt/power/session/translations/plugin-power-session_en.ts
    file_format: QT
    source_language: en_US
    translation_files_expression: src/plugin-qt/power/session/translations/plugin-power-session_<lang>.ts

settings:
  pr_branch_name: transifex_update_<br_unique_id>

详细解释:

  1. 增加了 name: power-session-translations:这是一个可选但强烈推荐的字段。当你的项目有多个翻译文件(例如还有 settings、about 等模块的翻译)时,为每个 filter 命名可以让你在 Transifex 的 CI/CD 日志中清晰地看到哪个模块的翻译正在被处理。
  2. 保持了路径和通配符结构:原配置中的路径和 <lang> 通配符非常精准,符合 Qt Linguist 生成的 .ts 文件命名规范(如 _zh_CN.ts, _fr.ts),无需修改。
  3. 缩进规范:确保了列表项 - 后的属性缩进统一为 4 个空格,与 settings 下的属性对齐,提升了可读性。

如果你在后续集成 CI/CD(如 GitHub Actions 或 GitLab CI)来调用这个配置文件时遇到问题,欢迎随时向我提问!

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 29, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a Transifex configuration for the power session plugin, defining how the English source Qt translation file maps to per-language translation files and how Transifex-generated PR branches are named.

File-Level Changes

Change Details Files
Configure Transifex to manage Qt translation files for the power session plugin.
  • Introduce .tx/transifex.yaml with a file filter for the plugin-power-session Qt translation source file.
  • Set QT as the file format and en_US as the source language for the plugin-power-session translations.
  • Define the translation files naming pattern to map language-specific Qt translation files.
  • Configure the naming pattern for Transifex-generated PR branches for translation updates.
.tx/transifex.yaml

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

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: BLumia, mhduiy

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

@mhduiy
Copy link
Copy Markdown
Contributor Author

mhduiy commented May 29, 2026

/forcemerge

@deepin-bot
Copy link
Copy Markdown

deepin-bot Bot commented May 29, 2026

This pr force merged! (status: blocked)

@deepin-bot deepin-bot Bot merged commit 7c4f7f3 into linuxdeepin:master May 29, 2026
8 of 9 checks passed
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