WordPress po mo 文件
WordPress po mo file
大家好,我有一个问题。 Po 文件不起作用。我使用 qtransltae-x 进行翻译。然后我创建自定义 pot 文件
例子
# Copyright (C) 2015 Gawatt
msgid ""
msgstr ""
"Project-Id-Version: Gawatt 1.0.0\n"
"POT-Creation-Date: 2015-06-03 11:30+0400\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"X-Generator: Poedit 1.8.1\n"
#: club.php:25
msgid "zibil"
msgstr ""
然后我生成它`
# Copyright (C) 2015 Gawatt
msgid ""
msgstr ""
"Project-Id-Version: Gawatt 1.0.0\n"
"POT-Creation-Date: 2015-06-03 11:30+0400\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2015-06-03 12:45+0400\n"
"X-Generator: Poedit 1.7.6\n"
"Last-Translator: \n"
"Language-Team: \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"
"Language: ru_RU\n"
#: club.php:25
msgid "zibil"
msgstr "sdfsdfsdfsdf"
代码输出`
<?php _e('zibil'); ?>
并在 wp-config
define('WPLANG', 'ru_RU');
但是当我将语言切换到 russina 时它不起作用,你能帮我吗谢谢。
如果你想翻译你的主题,你需要告诉 Wordpress 在哪里可以找到翻译文件,使用:<?php load_theme_textdomain( $domain, $path ) ?>
, doc.
例如:
add_action('after_setup_theme', 'my_theme_setup');
function my_theme_setup(){
load_theme_textdomain('my_theme', get_template_directory() . '/languages');
}
并且在使用函数 _e()
时必须包含域,doc
像这样:<?php _e('zibil', 'mytheme'); ?>
.
大家好,我有一个问题。 Po 文件不起作用。我使用 qtransltae-x 进行翻译。然后我创建自定义 pot 文件
例子
# Copyright (C) 2015 Gawatt
msgid ""
msgstr ""
"Project-Id-Version: Gawatt 1.0.0\n"
"POT-Creation-Date: 2015-06-03 11:30+0400\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"X-Generator: Poedit 1.8.1\n"
#: club.php:25
msgid "zibil"
msgstr ""
然后我生成它`
# Copyright (C) 2015 Gawatt
msgid ""
msgstr ""
"Project-Id-Version: Gawatt 1.0.0\n"
"POT-Creation-Date: 2015-06-03 11:30+0400\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2015-06-03 12:45+0400\n"
"X-Generator: Poedit 1.7.6\n"
"Last-Translator: \n"
"Language-Team: \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"
"Language: ru_RU\n"
#: club.php:25
msgid "zibil"
msgstr "sdfsdfsdfsdf"
代码输出`
<?php _e('zibil'); ?>
并在 wp-config
define('WPLANG', 'ru_RU');
但是当我将语言切换到 russina 时它不起作用,你能帮我吗谢谢。
如果你想翻译你的主题,你需要告诉 Wordpress 在哪里可以找到翻译文件,使用:<?php load_theme_textdomain( $domain, $path ) ?>
, doc.
例如:
add_action('after_setup_theme', 'my_theme_setup');
function my_theme_setup(){
load_theme_textdomain('my_theme', get_template_directory() . '/languages');
}
并且在使用函数 _e()
时必须包含域,doc
像这样:<?php _e('zibil', 'mytheme'); ?>
.