Translation Issue with Wordpress Theme Check in comment_form function

I ended my wordpress theme, which called the_mdttheme.I tried to check it and get two errors with translation in comment

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 badges
Add a comment  | 

1 Answer 1

Reset to default 1

The _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 __()? :)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744609202a4583660.html

相关推荐

  • Translation Issue with Wordpress Theme Check in comment_form function

    I ended my wordpress theme, which called the_mdttheme.I tried to check it and get two errors with translation in comment

    1天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信