number_format_i18n
云策文档标注
概述
number_format_i18n 是一个 WordPress 过滤器,用于基于本地化设置格式化数字。它允许开发者修改数字的格式化输出,支持参数如原始数字和小数精度。
关键要点
- 过滤器名称:number_format_i18n
- 参数:$formatted(格式化后的字符串)、$number(原始浮点数)、$decimals(小数精度)
- 用途:在数字基于本地化转换时进行过滤,常用于自定义数字显示格式
- 相关函数:number_format_i18n(),位于 wp-includes/functions.php
- 版本历史:从 2.8.0 引入,4.9.0 添加了 $number 和 $decimals 参数
原文内容
Filters the number formatted based on the locale.
Parameters
$formattedstring-
Converted number in string format.
$numberfloat-
The number to convert based on locale.
$decimalsint-
Precision of the number of decimal places.
Source
return apply_filters( 'number_format_i18n', $formatted, $number, $decimals );