AI false-positive summary is not translatable and doubles punctuation

已关闭
#1,504 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

已经有一个关联 PR 被合并了。

  • #1505 来自 @ekamran —— 已合并

评估

难度
3/5
预计耗时
半天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃

调研方向

Start with the message assembly in assets/js/plugin-check-admin.js, where the AI summary is built from hard-coded English and a . is appended unless the text ends in ., ! or ?. Then check includes/CLI/Plugin_Check_Command.php, where ' AI detected %1$d %2$s' is appended to "Checks complete. No errors found." and the count sits outside the _n() plural string. Done when each part is a translatable sentence with its own punctuation and plural forms follow locale rules. A pull request (#1505) is already open against this issue, so check it before starting.

由索引模型根据 Issue 内容生成。

描述

Description

When AI analysis runs, the summary of possible false positives cannot be translated correctly, and it can end up with doubled punctuation.

Admin screen. assets/js/plugin-check-admin.js builds the AI part of the results message from hard-coded English ("AI detected … possible false positives", "Input tokens:", "Output tokens:", "Tokens spent:", "Model:"), so it stays in English on a translated site. It then adds . after the localized message unless that message ends in ., ! or ?. A Hindi message ending in । therefore gets a second stop: कोई त्रुटि नहीं मिली।. AI detected 5 possible false positives. …

WP-CLI. When a run with --ai has no errors or warnings left to show (for example with --ignore-errors), includes/CLI/Plugin_Check_Command.php appends . plus ' AI detected %1$d %2$s' to "Checks complete. No errors found.", so the line reads:

Success: Checks complete. No errors found.. AI detected 3 possible false positives (Tokens spent: 1,234)

The number also sits outside the plural string (' AI detected %1$d %2$s' with a separate _n( 'possible false positive', 'possible false positives', … )), which cannot be translated correctly in languages where the whole phrase changes with the count.

The CLI string was flagged by polyglots lint (https://github.com/emreerkan/polyglots) as plural-without-count.

Expected

Each part of the summary is a complete translatable sentence with its own punctuation, plural forms follow the locale's plural rules, and the parts are joined with a space.

AI Assisted: Claude Code helped find and reproduce this.

主要语言
PHP
星标
365
派生
131
平均合并
21 小时 11 分钟
30 天内合并 PR
19

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

WordPress/plugin-check 的其他 Issue

查看 WordPress/plugin-check 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。