我有一个代码跟随写在WordPress主题的functions.php
:
<?php
if(!function_exists('mytheme_entry_meta')){
function mytheme_entry_meta(){
if(!is_page()){
?>
<div class="entry-meta">
<?php printf(__('<span class="author">Posted by %1$s</span>', 'mytheme'), get_the_author()); ?>
<?php printf(__('<span class="date-pulished">at %1$s</span>', 'mytheme'), get_the_date()); ?>
<?php printf(__('<span class="category">in %1$s</span>', 'mytheme'), get_the_category_list(',')); ?>
<?php if(comments_open()){ ?>
<span class="meta-reply">
<?php comments_popup_link(
__('Leave a comment','mytheme'),
__('One comment','mytheme'),
__('% comments','mytheme'),
__('Read all comments','mytheme')
); ?>
</span>
<?php } ?>
</div>
<?php
}
}
}
?>
我使用POEDIT应用程序翻译成越南语。但POEDIT节目
Error: a format specification for argument 1 doesn't exist in 'msgstr'
% comments
中的位置错误。请参见以下2张图片:
答案 0 :(得分:2)
首先,您严格翻译了字符串并从源代码中省略了%
。其次,您的PO文件incorrectly marks the string as being php-format
while it isn’t,您必须在代码like this中修复:
/* xgettext:no-php-format */
__('% comments','mytheme'),