我将部署我的第一个插件,但是_e()和__()函数似乎不起作用。
在我的评论标题中:
Text Domain: add-to-post-footer
Domain Path: /languages我用poedit创建了.po和.mo文件,并将它们放在插件中的/languages中。我翻译成葡萄牙语,命名为'pt_BR.po/mo‘。在我的选项页中,有一些文本如下:
<?php echo __( 'With ', 'add-to-post-footer').ATPF_PLUGIN_NAME.__(' you can add some content at the final of all your posts without care about forget some of them, or the need to copy and paste boring proccess. Just go to Posts >> ', 'add-to-post-footer').ATPF_PLUGIN_NAME.__(', insert the content and save it. The proccess is the same to change the content. You just have to care about other stuff of your site/blog now', 'add-to-post-footer'); ?>但是当我输入本地主机wordpress安装语言巴西葡萄牙语时,什么都不会发生(只需保存按钮,因为默认情况下已在WP上翻译了save )
我做错了什么?
发布于 2016-03-26 16:46:49
您必须在插件中加载文本域:
<?php
function my_load_textdomain() {
load_plugin_textdomain(
'add-to-post-footer', // text domain identifier
false, // deprecated parameter
plugin_basename(dirname( __FILE__ )) . '/languages' ); // path to the languages directory
}
add_action('plugins_loaded', 'my_load_textdomain');https://wordpress.stackexchange.com/questions/221799
复制相似问题