wordpress 本地
WordPress is arguably the world’s leading content management system (CMS) in use today (some even argue that WordPress is much more than a CMS), powering over 60 million websites globally.
WordPress可以说是当今使用的世界领先的内容管理系统(CMS)(有人甚至认为WordPress不仅仅是CMS ),在全球拥有超过6000万个网站。
By default, WordPress is presented in U.S. English (en_US), but it does come with a built-in language capability. This has allowed the WordPress community to translate WordPress into several languages. WordPress themes, translation files and support have also been made available in various languages.
默认情况下,WordPress以美国英语(en_US)呈现,但它确实具有内置语言功能。 这使WordPress社区可以将WordPress翻译成多种语言。 WordPress主题,翻译文件和支持也已以多种语言提供。
WordPress i18n支持 (WordPress i18n Support)
WordPress uses the gettext libraries and tools for internationalization (i18n). It is the libraries that facilitate the internationalization of WordPress, themes and plugins.
WordPress使用gettext库和工具进行国际化(i18n) 。 它是促进WordPress,主题和插件国际化的库。
Note: i18n
is an abbreviation for internationalization and it’s called i18n because there are 18 letters between “i” and “n”.
注意: i18n
是国际i18n
的缩写,之所以称为i18n,是因为“ i”和“ n”之间有18个字母。
If you are not familiar with the concept of i18N, translations, and Gettext, I strongly encourage you to read this series on localization to have an understanding of what’s involved.
如果您不熟悉i18N,翻译和Gettext的概念,强烈建议您阅读本系列有关本地化的文章 ,以了解所涉及的内容。
In this article, I’ll cover the basics of WordPress i18n. I am going to walk you through the simple process of installing a localized version of WordPress (WordPress in your own language), and also show you how to turn an existing WordPress site to a localized version.
在本文中,我将介绍WordPress i18n的基础知识。 我将引导您完成安装WordPress本地化版本(使用您自己的语言的WordPress)的简单过程,并向您展示如何将现有的WordPress网站转换为本地化版本。
安装WordPress的本地化版本 (Installing a Localized Version of WordPress)
A lot of WordPress enthusiasts from different parts of the World have teamed-up to translate WordPress into their various languages.
来自世界各地的许多WordPress爱好者已经联合起来,将WordPress翻译成他们的各种语言。
For example, the French, German and Italian localized version of WordPress is available at fr.wordpress.org, de.wordpress.org and it.wordpress.org respectively.
例如,分别在fr.wordpress.org , de.wordpress.org和it.wordpress.org上可获得WordPress的法语,德语和意大利语本地化版本。
Let’s see how we can install a localized WordPress using the German internationalization as our benchmark for this tutorial.
让我们看看如何使用德语国际化作为本教程的基准来安装本地化的WordPress。
Head over to de.wordpress.org and download the German’s WordPress.
前往de.wordpress.org并下载德语的WordPress。
- FTP/SFTP into your web server and unzip the WordPress package to your preferred installation directory. FTP / SFTP到您的Web服务器,并将WordPress软件包解压缩到您的首选安装目录。
- Create a database for WordPress on your web server, and a MySQL user with all privileges. 在您的Web服务器上为WordPress创建数据库,并为MySQL用户提供所有特权。
Edit the
wp-config.php
file and add your database information.编辑
wp-config.php
文件并添加数据库信息。- Run the WordPress installation script by accessing the URL in a web browser. 通过在Web浏览器中访问URL来运行WordPress安装脚本。
You should have the WordPress in German up and running.
您应该启动并运行德语版WordPress 。
You might also want to check out the WordPress codex for other ways of installing WordPress.
您可能还想查看WordPress Codex,以了解其他安装WordPress的方法。
A full list of WordPress versions available in other languages is available at WP Central.
WP Central提供了其他语言版本的WordPress版本的完整列表。
将现有的WordPress网站转换为国际版本 (Turning an Existing WordPress Site into an International Version)
Let’s assume you are German and you have an existing WordPress website in English, but you weren’t aware that a German version of WordPress existed until you read this article. Based on this new found knowledge, you have decided to shake things up by changing your WordPress site from the default English version to a German translation. You might think it’s a very difficult task, but let me shock you a little. The entire process is as easy as following through the guide below, you don’t even need to reinstall WordPress.
假设您是德国人,并且已经有英文的WordPress网站,但是直到您阅读本文,您才意识到存在德语版WordPress。 基于这些新发现的知识,您已决定通过将WordPress网站从默认的英语版本更改为德语版本来改变现状。 您可能会认为这是一项非常艰巨的任务,但让我有些震惊。 整个过程就像通过下面的指南一样简单,您甚至不需要重新安装WordPress。
Continue reading to learn how to turn an existing WordPress blog to your own language (German as a case study).
继续阅读以了解如何将现有的WordPress博客转换为您自己的语言(以德国为例)。
Download your language’s .mo
file from the WordPress translation repository available at i18n.svn.wordpress.org. Get the German’s .mo
language file here.
从位于i18n.svn.wordpress.org的WordPress翻译库中下载您语言的.mo
文件。 在此处获取德语的.mo
语言文件。
The .mo
files are machine-readable, binary files that the gettext
functions actually use for translation.
.mo
文件是gettext
函数实际用于翻译的机器可读二进制文件。
The naming convention of the .mo
files is based on the ISO–639 language code (e.g. pt for Portuguese) followed by the ISO–3166 country code (e.g. PT for Portugal or BR for Brazil). So, the Brazilian Portuguese file would be called pt_BR.mo
, and a non-specific Portuguese file would be called pt.mo
. Hence, the German’s language file would be named de_DE.mo
.
.mo
文件的命名约定基于ISO–639语言代码(例如,葡萄牙语的pt)和ISO–3166国家/地区代码(例如,葡萄牙的PT或巴西的BR)。 因此,巴西葡萄牙语文件将称为pt_BR.mo
,非特定葡萄牙语文件将称为pt.mo
因此,德语语言文件将被命名为de_DE.mo
。
A complete lists of codes can be found at (country codes) and (language codes).
Now that we have downloaded the language .mo
file, we need to get it installed. To install it, create a new folder in WordPress /wp-content
installation directory called /languages
and upload the .mo file
to the languages folder you just created.
现在我们已经下载了语言.mo
文件,我们需要安装它。 要安装它,请在WordPress /wp-content
安装目录中创建一个名为/languages
的新文件夹,然后将.mo file
上传到您刚创建的languages文件夹中。
Open the wp-config.php
file and search for:
打开wp-config.php
文件并搜索:
define ('WPLANG', '');
Edit this line according to the .mo
file you have just downloaded. For example, using the German language, the name of the .mo
file is used as the value of the PHP constant WPLANG
:
根据刚刚下载的.mo
文件编辑此行。 例如,使用德语, .mo
文件的名称用作PHP常量WPLANG
的值:
define('WPLANG', 'de_DE');
Save and open your WordPress site. It should now display in the newly installed German language.
保存并打开您的WordPress网站。 现在,它应该以新安装的德语显示。
翻译时要注意的事 (Something to Keep in Mind with Translation)
I discovered that some terms were still displaying in English after the localizing one of my blogs to German. The reason is simply because the German .mo
file at the WordPress translation repository lacks translation for those terms.
我发现将我的一个博客本地化为德语后,某些术语仍以英语显示。 原因仅仅是因为WordPress翻译存储库中的German .mo
文件缺少这些术语的翻译。
Thankfully, at the WordPress Updates
page, I was provided a one-click installation option to automatically update the blog to the full-fledge localized German version.
值得庆幸的是,在WordPress Updates
页面上,为我提供了一键安装选项,可将博客自动更新为完整的本地化德语版本。

Tip: To be sure you’ve downloaded an up-to-date language .mo
file, it should be located in a version tagged folder. An example is the Spanish
language .mo
file for the current version of WordPress (3.9.1) located at i18n.svn.wordpress.org/es_ES/tags/3.9.1/messages/es_ES.mo.
提示:为确保您下载了最新的语言.mo
文件,该文件应位于带有版本标记的文件夹中。 一个示例是位于i18n.svn.wordpress.org/es_ES/tags/3.9.1/messages/es_ES.mo的WordPress当前版本(3.9.1)的Spanish
.mo
文件。
结论 (Conclusion)
Incredible features like this is what keeps the WordPress ecosystem thriving. People naturally feel comfortable working with a platform that’s extremely flexible, and the WordPress community keeps taking flexibility to a whole new level. The ability to use WordPress in your preferred language is an important feature, and as you’ve seen, one that’s very easily achieved.
如此令人难以置信的功能使WordPress生态系统蓬勃发展。 人们自然会在使用非常灵活的平台上感到自在,而WordPress社区将灵活性提高到了一个全新的水平。 以您喜欢的语言使用WordPress的功能是一项重要功能,正如您所看到的,这很容易实现。
Do you have any questions or contributions? I’ll be happy to respond to them in the comments.
您有任何问题或建议吗? 我很乐意在评论中回复他们。
wordpress 本地