我正在尝试转换插件字符串,但由于某些原因,我的插件无法通过\\u e()和\\u()函数找到字符串。
我的插件目录叫做测试插件。
我的插件/test-plugin/test-plugin.php
文件如下所示:
<?php
/*
Plugin Name: Test plugin
Version: 1.0
Author: Robbert Vermeulen
License: GPL2
Text Domain: test-plugin
*/
_e( \'This is a test text\', \'test-plugin\' );
__( \'This is another test text\', \'test-plugin\' )
function test_plugin_load_plugin_textdomain() {
load_plugin_textdomain( \'test-plugin\', FALSE, basename( dirname( __FILE__ ) ) . \'/languages/\' );
}
add_action( \'plugins_loaded\', \'test_plugin_load_plugin_textdomain\' );
?>
当我尝试同步字符串时,插件只会从插件描述中找到要翻译的值。
我必须做什么才能识别字符串?
我的测试插件。pot文件如下所示:
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Test plugin\\n"
"Report-Msgid-Bugs-To: \\n"
"POT-Creation-Date: 2018-11-13 16:16+0000\\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n"
"Language-Team: \\n"
"Language: \\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\\n"
"MIME-Version: 1.0\\n"
"Content-Type: text/plain; charset=UTF-8\\n"
"Content-Transfer-Encoding: 8bit\\n"
"X-Generator: Loco https://localise.biz/"
#. Author of the plugin
msgid "Robbert Vermeulen"
msgstr ""
#. Name of the plugin
msgid "Test plugin"
msgstr ""