我正在使用" polylang"插件进行多语言站点。因此,有些点不适合翻译字符串。我可以更改一些主题,以使其变得合适。但是,对于其他人来说,我不能。
这是下面的代码。
template-contacts.php
原始代码
if ( $message_btn ) : ?>
<div id="contacts-modal" class="reveal-modal">
<h1 class="entry-header"><?php _e( 'Send message', 'fluxus' ); ?></h1>
<div class="modal-contents"></div>
<a class="close-reveal-modal">×</a>
</div><?php
endif;
我已经更改代码为
if ( $message_btn ) : ?>
<div id="contacts-modal" class="reveal-modal">
<h1 class="entry-header"><?php pll_e( 'Send message' ); ?></h1>
<div class="modal-contents"></div>
<a class="close-reveal-modal">×</a>
</div><?php
endif;
这适用于部分。但是,有发送消息和查看地图按钮,还可以在页脚中"使用箭头%键进行导航"文本。我无法成功改变,解决这些部分。这是代码:
if ( $has_map ) {
$view_btn = '<a id="view-map" href="#" class="button icon-location">' . __( 'View map', 'fluxus' ) . '</a>';
} else {
$view_btn = '';
}
/**
* Show Send Message button only if there is a [contact-form-7] short tag
* in the content.
*/
if ( preg_match('/[contact-form-7.+?]/is', $post->post_content) ) {
$message_btn = '<a id="send-message" href="#" class="button icon-paper-plane">' . __( 'Send message', 'fluxus' ) . '</a>';
} else {
$message_btn = '';
}
?>
如何在上面的部分进行更改?
尝试将__( 'View map', 'fluxus' )
更改为pll__( 'View map' )
和 __( 'Send message', 'fluxus' )
to pll__( 'Send message' )
当然需要先前注册的"查看地图"one_answers"发送消息"
pll_e(
或 _e(
echo字符串和 __(
或 pll_(
返回字符串。