[Function _n] What wrong?

未关闭
#175 8 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
php, wordpress

调研方向

从提供的 _n() 调用和 Theme Check 翻译警告开始,然后检查 checker 如何计算 _n() 参数并识别文本域。使用 WooCommerce 代码片段重现该警告,并将其与 WordPress 的 _n() 参考进行比较;完成的标准是 checker 只报告实际的文本域,不再将 downloads_remaining 视为文本域。

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

描述

This code of Woocommerce Plugin:

echo apply_filters( 'woocommerce_available_download_count', '<span class="woocommerce-Count count">' . sprintf( _n( '%s download remaining', '%s downloads remaining', $download['downloads_remaining'], 'domain' ), $download['downloads_remaining'] ) . '</span> ', $download );

but Them check is warning:

WARNING: Found a translation function that has an incorrect number of arguments. Function _n, with the arguments '%s download remaining', '%s downloads remaining', downloads_remaining, 'domain'

I see code here:

https://developer.wordpress.org/reference/functions/_n/

And my text domain is domain:

Warning: More than one text-domain is being used in this theme. This means the theme will not be compatible with WordPress.org language packs.
The domains found are domain, downloads_remaining

I only found downloads_remaining in echo apply_filters( 'woocommerce_available_download_count', '<span class="woocommerce-Count count">' . sprintf( _n( '%s download remaining', '%s downloads remaining', $download['downloads_remaining'], 'domain' ), $download['downloads_remaining'] ) . '</span> ', $download );

What wrong?

主要语言
PHP
星标
372
派生
114
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

WordPress/theme-check 的其他 Issue

查看 WordPress/theme-check 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

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