“文本”;您必须登录才能发表评论"E;来自WordPress中的这一行:https://github.com/WordPress/WordPress/blob/efaf4a8938bbeb8510c8e1e4cc6fe84a434c17c3/wp-includes/comment-template.php#L2449
每当看到双下划线函数中包含的内容时__( ), 这意味着它是一个可翻译的字符串。
您可以使用这样的函数并将其添加到主题中functions.php 文件:
add_filter(\'gettext\', \'change_comment_logged_in_notice\', 20, 3);
/*
* Change the text for needing to be logged in to post a comment
*
**/
function change_comment_logged_in_notice( $translated_text, $untranslated_text, $domain ) {
switch( $untranslated_text ) {
case \'You must be <a href="%s">logged in</a> to post a comment.\':
$translated_text = __( \'You need to <a href="%s">log in</a>\' );
}
return $translated_text;
}
有关
gettext 过滤器:
https://developer.wordpress.org/reference/hooks/gettext/或者,您可以使用类似Loco Translate的插件,该插件可以查看可翻译的字符串,并在界面中进行翻译:https://en-ca.wordpress.org/plugins/loco-translate/