问题描述
因此,我遵循了对已发布在此处的主题的建议,但没有人回答此问题。 Polylangs 工作流程对我来说有点像量子物理学,所以我可能会错过一些东西......我已经在 woo 结帐中添加了一个投票,它工作正常。而且翻译也有点效果但是..
我的问题: ..Polylang 在翻译时忽略 html 结构并将字符串从其 div/H2 标签中抛出:
我想同样的事情也会发生在我没有做到的标签上。我尝试了一些带有无效回声的解决方案。任何人都可以帮助我指明方向吗?
function.php
add_action('init',function() {
pll_register_string('thankyou','What do you think about the shop?');
pll_register_string('OceanWP','Superb');
});
add_action( 'woocommerce_thankyou','thank_poll_form',10 );
function thank_poll_form( $order_id ) {
echo '<div class="thank-you-poll"><h2>'.pll_e('What do you think about the shop?').'</h2>
<form id="thankyou_form">
<label><input type="radio" name="like" value="superb"> Superb</label>
<label><input type="radio" name="like" value="good enough"> Good enough</label>
<label><input type="radio" name="like" value="could be better"> Could be better</label>
<input type="hidden" name="action" value="collect_feedback" />
<input type="hidden" name="order_id" value="' . $order_id . '" />
' . wp_nonce_field( 'thankyou'.$order_id,'thankyou_nonce',true,false ) . '
</form></div>';
}
渲染的 html
**Was hälst du von unserem Shop?**
<div class="thank-you-poll"><h2></h2>
<form id="thankyou_form">
<label><input type="radio" name="like" value="superb"> Superb</label>
<label><input type="radio" name="like" value="good enough"> Good enough</label>
<label><input type="radio" name="like" value="could be better"> Could be better</label>
<input type="hidden" name="action" value="collect_feedback">
<input type="hidden" name="order_id" value="4418">
<input type="hidden" id="thankyou_nonce" name="thankyou_nonce" value="7624232590"><input type="hidden" name="_wp_http_referer" value="/de/kasse/order-received/4418/?key=wc_order_fKU39RE1qr0iI&utm_nooverride=1">
</form></div>
编辑:我对上帝和他的十几个别名发誓,我之前确实尝试过“pll__”,这导致了一个严重的错误。现在绝望了,我再次尝试了它,它完成了我认为翻译应该做的事情。所以“pll__”而不是“pll__e”。我希望这可以帮助某人,所以我不会删除此线程。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)