我正在本地化wooccommerce并面临这个问题。在"商店"页面上,我有这样打印的"显示"信息:
printf( _x( '<p>Showing</p> <span> %1$d–%2$d of %3$d results </span>', '%1$d = first, %2$d = last, %3$d = total', 'woocommerce' ), $first, $last, $total );
所以,我去了管理面板,找到了这条消息,并输入了翻译,生成了新的mo文件,但页面上没有任何更改。这也适用于此页面上的其他邮件。然而,在页眉/页脚/侧边栏中,一切都正常。
来自i18n/languages/woocomerce-lt_lt.po:
#: templates/loop/result-count.php:32
#, php-format
#@ woocommerce
msgctxt "%1$d = first, %2$d = last, %3$d = total"
msgid "Showing %1$d–%2$d of %3$d results"
msgstr "Rodomi rezultatai %1$d–%2$d iš %3$d"
为什么邮件没有显示翻译?我该怎么办?
在主题的functions.php中有:
$lang = get_template_directory_uri() . '/languages';
load_theme_textdomain($textdomain, $lang);
而应该是:
$lang = get_template_directory() . '/languages';
load_theme_textdomain($textdomain, $lang);
所以语言根本没有被加载