wordpress翻译_如何查找和翻译可翻译的WordPress主题

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 many languages, 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)

Even though WordPress has great support for creating websites in any language, theme developers may not find it necessary to create translation ready themes. If you are going to create a website in a language other than English, then you need to make sure that the theme you are purchasing or downloading is translation ready.

即使WordPress对创建任何语言的网站都提供了强大的支持,主题开发人员也可能没有必要创建可翻译的主题。 如果要使用英语以外的其他语言创建网站,则需要确保购买或下载的主题已准备好翻译。

If you go to the WordPress theme directory’s tag filter interface, 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选项。 单击“查找主题”按钮,您将看到与查询匹配的结果。 您可以通过检查标签过滤器中的其他选项来进一步缩小搜索范围。

Finding translation WordPress themes in the official theme directory

Most good commercial themes and frameworks are also translation ready. However if you are unsure, then you can always ask them before making your purchase.

大多数好的商业主题和框架也都可以翻译。 但是,如果不确定,则可以在购买前随时询问他们。

如何翻译WordPress主题 (How to Translate a WordPress Theme)

After you have found a translation ready WordPress theme, download the theme on your computer and extract the theme files. In the extracted files, you will find languages folder. This folder should have a POT file, or in some cases there might be a .po or .mo file.

找到可翻译的WordPress主题后,将其下载到计算机上并提取主题文件。 在解压缩的文件中,您会找到语言文件夹。 该文件夹应该有一个POT文件,或者在某些情况下可能有一个.po或.mo文件。

什么是.pot .po和.mo文件 (What are .pot .po and .mo files)

WordPress and WordPress themes use a system called gettext for translations, localization and internationalization. In gettext the programmers use gettext calls for every translatable area of the program. These calls are then collected in a POT file. So basically a POT file is a template of translatable strings in a program.

WordPress和WordPress主题使用名为gettext的系统进行翻译,本地化和国际化。 在gettext中,程序员对程序的每个可翻译区域都使用gettext调用。 然后将这些呼叫收集到一个POT文件中。 因此,基本上,POT文件是程序中可翻译字符串的模板。

Using the POT file, translators then generate a .po (Portable Object) file for their language. The name of the file refers to the language it is for. For example, a French translation file would be named fr_FR.po. Basically this is the file that you will be translating.

译者使用POT文件为他们的语言生成一个.po(便携式对象)文件。 文件名指的是其使用的语言。 例如,法语翻译文件将被命名为fr_FR.po。 基本上,这是您将要翻译的文件。

Lastly the .mo files are the machine readable format of the .po file. It is generated from the .po file, so you don’t need to create it.

最后,.mo文件是.po文件的机器可读格式。 它是从.po文件生成的,因此您无需创建它。

使用Poedit进行翻译 (Translating using Poedit)

You can simply edit .pot and .po files in any text editor of your choice. Most linux based distributions come pre-installed with command line tools that can be used to generate .mo files. However, since you are just starting out with localization, it is highly recommended that you use a gettext editor. In this tutorial, we will show you how to translate a WordPress theme using Poedit, which is a gettext editor available for Windows, Mac and Linux. It is very easy to use and will help you quickly translate your WordPress theme without breaking translation files.

您可以在您选择的任何文本编辑器中简单地编辑.pot和.po文件。 大多数基于linux的发行版都预安装了可用于生成.mo文件的命令行工具。 但是,由于您只是从本地化开始,因此强烈建议您使用gettext编辑器。 在本教程中,我们将向您展示如何使用Poedit翻译WordPress主题,Poedit是可用于Windows,Mac和Linux的gettext编辑器。 它非常易于使用,将帮助您快速翻译WordPress主题而不会破坏翻译文件。

First thing you need to do is install Poedit. If your theme came with a .pot file, then go to File » New catalogue from POT file…. 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.

您需要做的第一件事是安装Poedit 。 如果您的主题带有.pot文件,请转至File»POT文件中的新目录… 。 选择主题随附的Pot文件。 当打开pot文件时,Poedit将显示另一个对话框,询问有关该项目的信息。 这里最重要的领域是语言。

Setting catalog properties for your Translation project

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 country and language code here.

当您填写目录属性框时,Poedit将询问您保存翻译文件的首选项。 翻译文件将以.po扩展名保存。 翻译文件的名称非常重要。 格式是将其保存为两个字母的language_country代码。 例如,法国的法语翻译应另存为fr_FR.po,埃及的阿拉伯语翻译应另存为ar_EG.po,英国的英文翻译应另存为en_UK。 您可以在此处找到您的国家和语言代码

After saving your file, you are now ready to translate your WordPress theme.

保存文件后,您现在就可以翻译WordPress主题了。

Translating a WordPress theme in Poedit

Poedit has a very simple interface. It lists all translatable strings, you can click on any string to translate it. There are three boxes below the list. One for the original string, second for the translation and the third box would show instructions for translators. When you translate a string, Poedit will automatically move to the next string in the queue. When you save your file, Poedit will automatically compile a .mo version of the file in the same directory.

Poedit的界面非常简单。 它列出了所有可翻译的字符串,您可以单击任何字符串进行翻译。 列表下面有三个框。 一个用于原始字符串,第二个用于翻译,第三个框将显示翻译说明。 翻译字符串时,Poedit将自动移至队列中的下一个字符串。 保存文件时,Poedit将自动在同一目录中编译文件的.mo版本。

Once you are done translating your theme, upload the theme to your WordPress website using FTP. Go to WordPress admin area in your browser and activate the theme.

完成主题翻译后, 使用FTP将主题上传到WordPress网站。 在浏览器中转到WordPress管理区域并激活主题。

设置WordPress以使用翻译主题 (Setting WordPress to Use Translated Theme)

If you are already using WordPress in the same language as your theme’s translation files, then WordPress will automatically pick up translation files for your theme. However, if you are using WordPress in default English, then you can still force WordPress to use translated files for the theme. Simply add this line of code in your wp-config.php file:

如果您已经使用与主题翻译文件相同语言的WordPress,则WordPress将自动为您的主题提取翻译文件。 但是,如果您使用默认英语的WordPress,则仍然可以强制WordPress使用主题的翻译文件。 只需在您的wp-config.php文件中添加以下代码行:


// Replace fr_FR with your language and country code.
define ('WPLANG', 'fr_FR');

By adding this line you are telling WordPress to use translation files for these languages. However, since you are not using WordPress in that language and there are no translation files for WordPress backend. WordPress admin area will fallback to English, but your theme will be displayed using the translation files.

通过添加此行,您可以告诉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 global 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附加组件等来回报您。

Let us know if you have any questions or feedback by leaving a comment below.

请在下面留下评论,让我们知道您是否有任何疑问或反馈。

翻译自: https://www.wpbeginner.com/wp-themes/find-translate-translation-ready-wordpress-theme/

wordpress翻译

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值