国际化 (i18n) 与本地化 (l10n)
esc_html
将 < > & ” ‘(小于号,大于号,&,双引号,单引号)编码,转成HTML 实体,已经是实体的并不转换。
功能和esc_attr类似。
https://blog.wpjam.com/function_reference/esc_html/
https://blog.wpjam.com/function_reference/esc_html__/
https://blog.wpjam.com/function_reference/esc_html_e/
源文件:
wp-includes/l10n.php
举例:
$posted_on = sprintf(
/* translators: %s: post date. */
esc_html_x( 'Posted on %s', 'post date', 'wp-bootstrap-4' ),
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
);
//来源:bootstrap4主题
关于php程序国际化(i18n)的那些事