我正在使用Divi主题和Polylang插件。我使用Polylang添加波斯尼亚语(bs\\U BA)。我知道如何为Polylang注册字符串并以这种方式进行翻译,但我无法正确地处理复数,因为波斯尼亚语的1、2-4和5+有不同的形式,所以我尝试使用POEDIT。我已将此添加到我的子主题的函数中。php文件:
function my_lang_function() {
load_child_theme_textdomain( "Divi", get_stylesheet_directory() . "/includes/builder/languages" );
}
add_action( "after_setup_theme", "my_lang_function" );
这是我在自定义模块中的一行: $output.="<li class=\'bedroom\'>".sprintf(_nx("%d bedroom", "%d bedrooms", $custom["bedroom_count"][0], "noun", "custom-strings"), $custom["bedroom_count"][0])."</li>";
我创建了一个bs\\U BA。po文件,并将其放在/includes/builder/languages文件夹中,编译为。mo并将其放在那里:# Translation of Divi custom modules to Bosnian
msgid ""
msgstr ""
"PO-Revision-Date: 2018-09-14 20:09+0200\\n"
"MIME-Version: 1.0\\n"
"Content-Type: text/plain; charset=UTF-8\\n"
"Content-Transfer-Encoding: 8bit\\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\\n"
"X-Generator: Poedit 1.8.11\\n"
"Language: bs_BA@latin\\n"
"Project-Id-Version: Divi \\n"
"POT-Creation-Date: \\n"
"Last-Translator: \\n"
"Language-Team: \\n"
"X-Poedit-KeywordsList: _n:1,2,3\\r_n_noop:1,2,3\\r_nx:1,2,3\\r_nx_noop:1,2,3\\n"
#:
msgid "bedrooms"
msgstr "test bedrooms"
#:
msgid "bedroom"
msgstr "test bedroom"
我仍然只看到英语,我不知道我做错了什么。