admin管理员组文章数量:1389933
I ended my wordpress theme, which called the_mdttheme.
I tried to check it and get two errors with translation in comment_form()
.
Can't understand what did wrong, can someone help me? Here is two warnings:
WARNING: Found a translation function that is missing a text-domain. Function _x, with the arguments 'Comment', 'the_mdttheme'
WARNING: Found a translation function that is missing a text-domain. Function _x, with the arguments 'Comment *', 'the_mdttheme'
Here is my code, warnings are inside 'comment_field'
:
$args = array(
'comment_field' => '<p class="comment-form-comment"><label class="hidden" for="comment">' . _x( 'Comment', 'the_mdttheme' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" required="required" placeholder="' . _x( 'Comment *', 'the_mdttheme' ) . '"></textarea></p>',
'submit_button' => '<div class="form-submit-wrapper"><input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" /></div>',
'label_submit' => __( 'comment', 'the_mdttheme' ),
);
comment_form($args);
Thanks in advance!
I ended my wordpress theme, which called the_mdttheme.
I tried to check it and get two errors with translation in comment_form()
.
Can't understand what did wrong, can someone help me? Here is two warnings:
WARNING: Found a translation function that is missing a text-domain. Function _x, with the arguments 'Comment', 'the_mdttheme'
WARNING: Found a translation function that is missing a text-domain. Function _x, with the arguments 'Comment *', 'the_mdttheme'
Here is my code, warnings are inside 'comment_field'
:
$args = array(
'comment_field' => '<p class="comment-form-comment"><label class="hidden" for="comment">' . _x( 'Comment', 'the_mdttheme' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" required="required" placeholder="' . _x( 'Comment *', 'the_mdttheme' ) . '"></textarea></p>',
'submit_button' => '<div class="form-submit-wrapper"><input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" /></div>',
'label_submit' => __( 'comment', 'the_mdttheme' ),
);
comment_form($args);
Thanks in advance!
Share Improve this question asked Apr 1, 2020 at 19:24 AslanAslan 557 bronze badges1 Answer
Reset to default 1The _x()
function is meant to be used with the same string/text which has two or more different meanings/contexts, e.g. "read" can be a verb (I can read music.
) or noun (It's a good read.
).
And when you use _x()
, the context is the second parameter and the text domain is the third parameter, but in your code, you incorrectly used _x()
, where these are missing the context:
_x( 'Comment', 'the_mdttheme' )
_x( 'Comment *', 'the_mdttheme' )
But that would actually be seen as missing the text domain since it's supposed to be the third parameter.
So either provide the context (and also do so with your POT file) or perhaps you meant to use __()
? :)
本文标签: Translation Issue with Wordpress Theme Check in commentform function
版权声明:本文标题:Translation Issue with Wordpress Theme Check in comment_form function 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744609201a2615548.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论