
WordPress 翻译
WordPress is the most popular open source content management system in the world. It is used by hundreds of millions of users to create websites in many different languages. Recently, one of our users asked us how they can translate a WordPress theme into their local language. WordPress itself is available in 许多语言, and there are also numerous WordPress themes and plugins that have translations for multiple languages. Most of the time, these translations are done by users like yourself. Most WordPress themes and plugin authors welcome community users to help translate their work into other languages. In this article we will show you how to find and translate a translation ready WordPress theme.
WordPress是世界上最流行的开源内容管理系统。 数亿用户使用它来创建许多不同语言的网站。 最近,我们的一位用户问我们如何将WordPress主题翻译成他们的本地语言。 WordPress本身支持多种语言 ,并且还有许多WordPress主题和插件,具有多种语言的翻译。 大多数情况下,这些翻译是由像您这样的用户完成的。 大多数WordPress主题和插件作者都欢迎社区用户帮助将其工作翻译成其他语言。 在本文中,我们将向您展示如何查找和翻译可翻译的WordPress主题。
查找可翻译的WordPress主题 (Finding a Translation Ready WordPress Theme)
尽管 WordPress 非常支持以任何语言创建网站,但主题开发人员可能发现没有必要创建可翻译的主题。如果您打算使用英语以外的语言创建网站,那么您需要确保您购买或下载的主题已准备好翻译。
尽管 WordPress 为以任何语言创建网站提供了强大的支持,但主题开发人员可能不需要创建可翻译的主题。如果您想使用英语以外的语言创建网站,则需要确保您购买或下载的主题已准备好翻译。
If you go to the WordPress theme directory’s 标签过滤器接口, then you will see a list of option, which are actually tags theme developers have added to their themes. Check the box next to translation ready option. If you are going to translate your theme into a right-to-left language like Arabic, Hebrew, and Persian, then you should also check rtl-language-support option. Click on the Find Themes button, and you will see the results that match your query. You can further narrow down your search by checking other options in the tag filter.
如果转到WordPress主题目录的标签过滤器接口 ,那么您将看到一个选项列表,实际上是主题开发人员已添加到其主题的标签。 选中“翻译准备就绪”选项旁边的框。 如果要将主题翻译成从右到左的语言(例如阿拉伯语,希伯来语和波斯语),则还应该选中rtl-language-support选项。 单击“查找主题”按钮,您将看到与查询匹配的结果。 您可以通过检查标签过滤器中的其他选项来进一步缩小搜索范围。

大多数优秀的商业主题和框架也可以翻译。但是,如果您不确定,可以随时在购买前询问他们。
大多数优秀的商业主题和框架也是可翻译的。但是,如果您不确定,您可以随时在购买前询问他们。
如何翻译WordPress主题 (How to Translate a WordPress Theme)
找到可供翻译的 WordPress 主题后,将主题下载到您的计算机上并解压主题文件。在提取的文件中,您将找到 languages 文件夹。此文件夹应该有一个 POT 文件,或者在某些情况下可能有一个 . po 或 .mo 文件。
找到可翻译的 WordPress 主题后,将其下载到您的计算机并解压主题文件。在解压缩的文件中,您将找到语言文件夹。该文件夹应包含 POT 文件,或者在某些情况下包含 .po 或 .mo 文件。
什么是.pot .po和.mo文件 (What are .pot .po and .mo files)
WordPress 和 WordPress 主题使用名为 gettext 的系统进行翻译、本地化和国际化。在 gettext 中,程序员对程序的每个可翻译区域使用 gettext 调用。然后将这些调用收集到 POT 文件中。所以基本上 POT 文件是程序中可翻译字符串的模板。
WordPress 和 WordPress 主题使用名为 gettext 的系统进行翻译、本地化和国际化。在 gettext 中,程序员对程序的每个可翻译区域都使用 gettext 调用。然后将这些调用收集到 POT 文件中。所以基本上,POT 文件是程序中可翻译字符串的模板。
使用 POT 文件,翻译人员可以为其语言生成 .po(可移植对象)文件。文件的名称指的是它所使用的语言。例如,法语翻译文件将命名为 fr_FR.po。基本上这是您要翻译的文件。
翻译人员使用 POT 文件为其语言生成 .po(可移植对象)文件。文件名是指编写该文件所用的语言。例如,法语翻译文件将命名为 fr_FR.po。基本上,这就是您要翻译的文件。
最后,.mo 文件是 .po 文件的机器可读格式。它是从 .po 文件生成的,因此您不需要创建它。
最后,.mo 文件是 .po 文件的机器可读格式。它是从 .po 文件生成的,因此您不需要创建它。
使用Poedit进行翻译 (Translating using Poedit)
您可以在您选择的任何文本编辑器中简单地编辑 .pot 和 .po 文件。大多数基于 Linux 的发行版都预装了可用于生成 .mo 文件的命令行工具。但是,由于您刚刚开始本地化,因此强烈建议您使用 gettext 编辑器。在本教程中,我们将向您展示如何使用 Poedit 翻译 WordPress 主题,Poedit 是适用于 Windows、Mac 和 Linux 的 gettext 编辑器。它非常易于使用,可以帮助您快速翻译 WordPress 主题,而不会破坏翻译文件。
您可以在您选择的任何文本编辑器中简单地编辑 .pot 和 .po 文件。大多数基于 Linux 的发行版都预装了可用于生成 .mo 文件的命令行工具。但是,由于您刚刚开始本地化,因此强烈建议您使用 gettext 编辑器。在本教程中,我们将向您展示如何使用 Poedit(适用于 Windows、Mac 和 Linux 的 gettext 编辑器)翻译 WordPress 主题。它非常易于使用,可以帮助您快速翻译 WordPress 主题,而不会损坏翻译文件。
First thing you need to do is install 诗歌. If your theme came with a .pot file, then go to 文件 » POT 文件的新目录.... Select the pot file that came with your theme. When you open the pot file, Poedit will show you another dialogue box asking information about the project. The most important field here is language.
您需要做的第一件事是安装诗歌 。 如果您的主题带有.pot文件,请转至文件»POT 文件中的新目录... 。 选择主题随附的Pot文件。 当打开pot文件时,Poedit将显示另一个对话框,询问有关该项目的信息。 这里最重要的领域是语言。

When you fill in the catalog properties box, Poedit will ask you for your saving preference of the translation file. The translation file will be saved with a .po extension. The name of the translation file is very important. The format is to save it in two letter language_country code. For example, a French translation for France should be saved as fr_FR.po, an Arabic translation for Egypt will be saved as ar_EG.po, and an English translation for United Kingdom will be saved as en_UK. You can find your 国家和语言代码 here.
当您填写目录属性框时,Poedit将询问您保存翻译文件的首选项。 翻译文件将以.po扩展名保存。 翻译文件的名称非常重要。 格式是将其保存为两个字母的language_country代码。 例如,法国的法语翻译应另存为fr_FR.po,埃及的阿拉伯语翻译应另存为ar_EG.po,英国的英文翻译应另存为en_UK。 您可以在此处找到您的国家和语言代码 。
保存文件后,您现在就可以翻译 WordPress 主题了。
保存文件后,您现在可以翻译您的 WordPress 主题。

Poedit 有一个非常简单的界面。它列出了所有可翻译的字符串,您可以单击任何字符串来翻译它。列表下方有三个框。第一个用于原始字符串,第二个用于翻译,第三个框将显示翻译人员的说明。当您翻译一个字符串时,Poedit 将自动移至队列中的下一个字符串。当您保存文件时,Poedit 将自动在同一目录中编译该文件的 .mo 版本。
Poedit的界面非常简单。它列出了所有可翻译的字符串,您可以单击任何字符串来翻译它。列表下方有三个框。第一个用于原始字符串,第二个用于翻译,第三个框将显示翻译说明。当翻译一个字符串时,Poedit 会自动移动到队列中的下一个字符串。当您保存文件时,Poedit会自动在同一目录中编译该文件的.mo版本。
Once you are done translating your theme, upload the theme to your WordPress website 使用FTP. Go to WordPress admin area in your browser and activate the theme.
完成主题翻译后, 使用FTP将主题上传到WordPress网站。 在浏览器中转到WordPress管理区域并激活主题。
设置WordPress以使用翻译主题 (Setting WordPress to Use Translated Theme)
如果您已经使用与主题翻译文件相同的语言的 WordPress,那么 WordPress 将自动为您的主题选取翻译文件。但是,如果您使用默认英语的 WordPress,那么您仍然可以强制 WordPress 使用主题的翻译文件。只需将这行代码添加到您的 wp-config.php 文件中:
如果您已经使用与主题翻译文件相同的语言的 WordPress,WordPress 将自动提取主题的翻译文件。但是,如果您使用默认英语的 WordPress,您仍然可以强制 WordPress 使用主题的翻译文件。只需在 wp-config.php 文件中添加以下代码行:
// Replace fr_FR with your language and country code.
define ('WPLANG', 'fr_FR');
通过添加此行,您将告诉 WordPress 使用这些语言的翻译文件。但是,由于您没有使用该语言的 WordPress,并且 WordPress 后端没有翻译文件。 WordPress 管理区域将回退为英语,但您的主题将使用翻译文件显示。
通过添加此行,您可以告诉 WordPress 使用这些语言的翻译文件。但是,由于您没有使用该语言的 WordPress,并且 WordPress 后端没有翻译文件。 WordPress 管理区域将恢复为英语,但您的主题将使用翻译文件显示。
We hope that this article helped you translate WordPress theme into your own language. If you are not a developer, and you want to contribute back to the community, then translation is one of the best ways to give back to the larger 全球的 WordPress community. Most theme and plugin authors really appreciate user involvement and some might even reward you by giving you extra support, PRO add-ons, etc.
我们希望本文能帮助您将WordPress主题翻译成您自己的语言。 如果您不是开发人员,并且想回馈社区,那么翻译是回馈更大的全世界 WordPress社区的最佳方法之一。 大多数主题和插件作者都非常感谢用户的参与,甚至可以通过提供额外的支持,PRO附加组件等来回报您。
如果您有任何问题或反馈,请在下面发表评论,让我们知道。
如果您有任何问题或反馈,请在下面发表评论并告诉我们。
翻译自: https://www.wpbeginner.com/wp-themes/find-translate-translation-ready-wordpress-theme/
WordPress 翻译