wp_get_list_item_separator()
云策文档标注
概述
wp_get_list_item_separator() 函数用于根据当前区域设置(locale)获取列表项分隔符。它返回一个本地化的字符串,通常用于在列表中分隔项目。
关键要点
- 函数返回基于区域设置的列表项分隔符字符串。
- 如果 $wp_locale 未实例化,则返回默认的英文逗号加空格(', ')。
- 函数内部依赖于 WP_Locale::get_list_item_separator() 来获取本地化分隔符。
代码示例
function wp_get_list_item_separator() {
global $wp_locale;
if ( ! ( $wp_locale instanceof WP_Locale ) ) {
// Default value of WP_Locale::get_list_item_separator().
/* translators: Used between list items, there is a space after the comma. */
return __( ', ' );
}
return $wp_locale->get_list_item_separator();
}
原文内容
Retrieves the list item separator based on the locale.
Source
function wp_get_list_item_separator() {
global $wp_locale;
if ( ! ( $wp_locale instanceof WP_Locale ) ) {
// Default value of WP_Locale::get_list_item_separator().
/* translators: Used between list items, there is a space after the comma. */
return __( ', ' );
}
return $wp_locale->get_list_item_separator();
}
Changelog
| Version | Description |
|---|---|
| 6.0.0 | Introduced. |