WordPress插件的语言国际化

$ brew install wp-cli

# Create a POT file for the WordPress plugin/theme in the current directory
# wp i18n make-pot . languages/my-plugin.pot
# Create a POT file for the continents and cities list in WordPress core.
#wp i18n make-pot . continents-and-cities.pot --include="wp-admin/includes/continents-cities.php" --ignore-domain

$ wp i18n make-pot . languages/SpeakIt-zh_CN.po

$ brew install gettext
 
$ brew link --force gettext
 
$ brew install Gtranslator

# 比较好用的反而是QT的 Linguist, 其实直接文本编辑器编辑,更直接
$ gtranslator languages/SpeakIt-zh_CN.po

$ msgfmt -o SpeakIt-zh_CN.mo SpeakIt-zh_CN.po 

调试的时候,通过在 wp-config.php 中定义 define('WPLANG', 'zh_CN');  来切换语言类型。

参考链接


发布者

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注