函数文档

__ngettext_noop()

💡 云策文档标注

概述

__ngettext_noop() 是一个已弃用的 WordPress 函数,用于在 POT 文件中注册复数字符串但不进行翻译。自 WordPress 2.8.0 起,建议使用 _n_noop() 替代。

关键要点

  • __ngettext_noop() 函数已弃用,自 WordPress 2.8.0 起应改用 _n_noop()。
  • 该函数主要用于国际化(i18n)场景,在 POT 文件中注册复数形式的字符串,但不执行实际翻译。
  • 函数内部调用 _deprecated_function() 来标记弃用状态,并在使用时发出警告。

注意事项

在开发中应避免使用此弃用函数,以保持代码兼容性和遵循 WordPress 最佳实践。


📄 原文内容

Register plural strings in POT file, but don’t translate them.

Description

See also

Source

function __ngettext_noop( ...$args ) { // phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
	_deprecated_function( __FUNCTION__, '2.8.0', '_n_noop()' );
	return _n_noop( ...$args );

}

Changelog

Version Description
2.8.0 Deprecated. Use _n_noop()
2.5.0 Introduced.