WordPress: Translating WordPress:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
无编辑摘要
无编辑摘要
第1行: 第1行:
__TOC__
__TOC__
__TOC__
''Internationalization'' and ''localization'' are terms  used to describe the effort to make WordPress (and other such projects) available in languages other than English, for people from different locales, who use different dialects and local preferences.


''国际化'' 和 ''地方化''是术语,用来描述使WordPress(和其它这样的项目)以英语以外的其它语言显示,供不同地区,持不同方言和地方特色的网民使用。
''国际化'' 和 ''地方化''是术语,用来描述使WordPress(和其它这样的项目)以英语以外的其它语言显示,供不同地区,持不同方言和地方特色的网民使用。
The process of localizing a program has two steps. The first step is when the program's developers provide a mechanism and method for the eventual translation of the program and its interface to suit local preferences and languages for users worldwide. WordPress developers have done this, so in theory, WordPress can be used in any language.


将这个软件本地化需要两个步骤。第一步是软件的开发者提供一个机制和方法来最终地翻译软件和界面来适应本地的特点和用户的语言。WordPress开发者已经完成了这一步,因此从理论上来讲,WordPress可以在任何语言背景中使用。
将这个软件本地化需要两个步骤。第一步是软件的开发者提供一个机制和方法来最终地翻译软件和界面来适应本地的特点和用户的语言。WordPress开发者已经完成了这一步,因此从理论上来讲,WordPress可以在任何语言背景中使用。


The second step is the actual ''localization'', the process by which the text on the page and other settings are translated and adapted to another language and culture, using the framework prescribed by the developers of the software. WordPress has already been localized into many other languages (see [[WordPress:WordPress in Your Language]] for more information).


第二步就是真正地''本地化'',网页上的文本和其它的设置都翻译好了,并且符合其它的语言和文化习惯,并且使用了软件开发者指定的构架。WordPress已经被本地化翻译为许多种语言(更多的信息,请看看[[WordPress:WordPress in Your Language|英语外其它语言的WordPress]])。
第二步就是真正地''本地化'',网页上的文本和其它的设置都翻译好了,并且符合其它的语言和文化习惯,并且使用了软件开发者指定的构架。WordPress已经被本地化翻译为许多种语言(更多的信息,请看看[[WordPress:WordPress in Your Language|英语外其它语言的WordPress]])。
This article explains how translators (bi- or multi-lingual WordPress users) can go about localizing WordPress to more languages.


这篇文章解释了翻译者(双语或者多个语言的WordPress用户)怎样才能将WordPress本地化为更多的语言。
这篇文章解释了翻译者(双语或者多个语言的WordPress用户)怎样才能将WordPress本地化为更多的语言。
== Translating WordPress ==
== 翻译 WordPress ==
== 翻译 WordPress ==
Before you start translating WordPress, check [[WordPress:WordPress in Your Language]] (and resources cited there) to see if a translation of WordPress into your language already exists. It is also possible that someone (or a team) is already working on translating WordPress into your language, but they haven't finished yet. To find out, subscribe to the [[WordPress:Mailing_Lists#Polyglots|wp-polyglots mailing list]], introduce yourself, and ask if there's anyone translating into your language. There is also a list of [[WordPress:L10n:Localization_Teams|localization teams]] and [[WordPress:L10n:Teams Currently Forming|localization teams currently forming]], which you can check to see if a translation is in progress.


在你开始翻译WordPress之前,查看[[WordPress:WordPress in Your Language|英语外其它语言的WordPress]] (以及那里引用的资源)是否已有了将WordPress翻译为你的语言的版本。也有可能每个人或者(一个组)已经开始将WordPress翻译为你的母语,但是他们还没有翻译完。要找到这样的信息,订阅[[WordPress:Mailing_Lists#Polyglots|wp-polyglots mailing list]],介绍你自己,并且问问有没有什么人正将WordPress翻译为你的母语。也有一个[[WordPress:L10n:Localization_Teams|本地化小组]] 和 [[WordPress:L10n:Teams Currently Forming|正在形成的本地化小组]]列表,你可以查看这个列表看看翻译是不是正在进行。
在你开始翻译WordPress之前,查看[[WordPress:WordPress in Your Language|英语外其它语言的WordPress]] (以及那里引用的资源)是否已有了将WordPress翻译为你的语言的版本。也有可能每个人或者(一个组)已经开始将WordPress翻译为你的母语,但是他们还没有翻译完。要找到这样的信息,订阅[[WordPress:Mailing_Lists#Polyglots|wp-polyglots mailing list]],介绍你自己,并且问问有没有什么人正将WordPress翻译为你的母语。也有一个[[WordPress:L10n:Localization_Teams|本地化小组]] 和 [[WordPress:L10n:Teams Currently Forming|正在形成的本地化小组]]列表,你可以查看这个列表看看翻译是不是正在进行。
=== Qualifications ===


=== 资格 ===
=== 资格 ===


Assuming that a WordPress translation into your language does not already exist or has someone working on it, you may want to volunteer to create a public translation of WordPress into your language. If so, here are the qualifications you will need:
假如WordPress还没有翻译为你的语言或者有人正在翻译,你可能想要作为志愿者来一起将WordPress翻译为你的母语,下面是你所需要的资格:
 
假入WordPress还没有翻译为你的语言或者有人正在翻译,你可能想要作为志愿者来一起将WordPress翻译为你的母语,下面是你所需要的资格:
 
* You need to be truly bilingual -- fluent in both written English and the language(s) you will be translating into. Casual knowledge of either one will make translating difficult for you, or make the localization you create confusing to native speakers.


*你必须真正能够运用双语—对英语和你要翻译成的语言非常熟练。对两种语言掌握不透,会使得翻译对你来讲变得很难,或者你翻译后的WordPress版本,本地人看不懂。
*你必须真正能够运用双语—对英语和你要翻译成的语言非常熟练。对两种语言掌握不透,会使得翻译对你来讲变得很难,或者你翻译后的WordPress版本,本地人看不懂。
* You need to be familiar with PHP, as you will sometimes need to read through the WordPress code to figure out the best way to translate messages.


*你需要熟悉PHP,因为你有时候需要通读WordPress编码来领会翻译这个信息的最好的方法。
*你需要熟悉PHP,因为你有时候需要通读WordPress编码来领会翻译这个信息的最好的方法。
* You should be familiar with human language constructs: nouns, verbs, articles, etc., different types of each, and be able to identify variations of their contexts in English.


*你应该熟悉人类语言构造:名词,动词,冠词等等,每种词的不同类型,并且能够识别这些词在不同的英语语境中的意思。
*你应该熟悉人类语言构造:名词,动词,冠词等等,每种词的不同类型,并且能够识别这些词在不同的英语语境中的意思。
=== About Locales ===


=== 关于本地化 ===
=== 关于本地化 ===
A '''locale''' is a combination of language and regional dialect. Usually locales correspond to countries, as is the case with Portuguese (Portugal) and Portuguese (Brazil).


'''本地化'''是指语言与当地方言之间的结合。一般来说,本地化是指国家本地化,如葡萄牙语(葡萄牙),葡萄牙语(巴西)。
'''本地化'''是指语言与当地方言之间的结合。一般来说,本地化是指国家本地化,如葡萄牙语(葡萄牙),葡萄牙语(巴西)。
You can do a translation for any locale you wish, even other English locales such as Canadian English or Australian English, to adjust for regional spelling and idioms.


你可以将WordPress翻译为任何国家的语言,甚至是其它种类的英语,如加拿大英语或者澳大利亚英语,来适应当地的拼写和习惯用法。
你可以将WordPress翻译为任何国家的语言,甚至是其它种类的英语,如加拿大英语或者澳大利亚英语,来适应当地的拼写和习惯用法。
The default locale of WordPress is U.S. English.


WordPress默认语言是美国英语。
WordPress默认语言是美国英语。
== Localization Technology ==


== 本地化技术 ==
== 本地化技术 ==
WordPress's developers chose to use the [http://www.gnu.org/software/gettext/gettext.html GNU gettext] localization framework to provide localization infrastructure to WordPress. gettext is a mature, widely used framework for modular translation of software, and is the ''de facto'' standard for localization in the open source/free software realm.
WordPress的开发者选择使用[http://www.gnu.org/software/gettext/gettext.html GNU gettext]本地化框架来提供WordPress本地化的基本结构。Gettext是一个成熟的,广泛使用的,软件翻译模框架,而且是免费软件领域/开放源码本地化的''实际''标准。
WordPress的开发者选择使用[http://www.gnu.org/software/gettext/gettext.html GNU gettext]本地化框架来提供WordPress本地化的基本结构。Gettext是一个成熟的,广泛使用的,软件翻译模框架,而且是免费软件领域/开放源码本地化的''实际''标准。
gettext uses ''message-level'' translation &mdash; that is, every "message" displayed to users is translated individually, whether it be a paragraph or a single word. In WordPress, such "messages" are generated, translated, and used by the WordPress PHP files via two PHP functions. <tt>__()</tt> is used when the message is passed as an argument to another function; <tt>_e()</tt> is used to write the message directly to the page. More detail on these two functions:


gettext使用''消息标准''的翻译&mdash;就是说,显示给用户的每个"消息"都是单个翻译的,不管这个消息是一段话还是一个单词。在WordPress中,WordPress PHP 文件通过两个PHP函数产生,翻译,并且使用这样的"消息"。当消息作为参数传给另一个函数的时候,会用到<tt>__()</tt>;使用<tt>_e()</tt>直接在网页上写信息。更多的关于这两个函数的详细信息:
gettext使用''消息标准''的翻译&mdash;就是说,显示给用户的每个"消息"都是单个翻译的,不管这个消息是一段话还是一个单词。在WordPress中,WordPress PHP 文件通过两个PHP函数产生,翻译,并且使用这样的"消息"。当消息作为参数传给另一个函数的时候,会用到<tt>__()</tt>;使用<tt>_e()</tt>直接在网页上写信息。更多的关于这两个函数的详细信息:
; <tt>__($message)</tt> : Searches the localization module for the translation of <tt>$message</tt>, and passes the translation to the PHP <tt>return</tt> statement. If no translation is found for <tt>$message</tt>, it just returns <tt>$message</tt>.


; <tt>__($message)</tt> :搜索翻译<tt>$message</tt>的本地化模块,并且将翻译传递给PHP<tt>返回</tt>申明。如果没有找到<tt>$message</tt>的翻译,只会返回<tt>$message</tt>。
; <tt>__($message)</tt> :搜索翻译<tt>$message</tt>的本地化模块,并且将翻译传递给PHP<tt>返回</tt>申明。如果没有找到<tt>$message</tt>的翻译,只会返回<tt>$message</tt>。


; <tt>_e($message)</tt> : Searches the localization module for the translation of <tt>$message</tt>, and passes the translation to the PHP <tt>echo</tt> statement. If no translation is found for <tt>$message</tt>, it just echoes <tt>$message</tt>.
;<tt>_e($message)</tt> : 搜索翻译<tt>$message</tt>的本地化模块,并且将翻译传递给PHP<tt>echo</tt>申明。如果没有找到<tt>$message</tt>的翻译,只会echoes<tt>$message</tt>。
 
<tt>_e($message)</tt> : 搜索翻译<tt>$message</tt>的本地化模块,并且将翻译传递给PHP<tt>echo</tt>申明。如果没有找到<tt>$message</tt>的翻译,只会echoes<tt>$message</tt>。
 
Note that if you are internationalizing a Theme or Plugin, you should use a "Text Domain". See [[WordPress:Writing a Plugin]] for more information on how to do this for a plugin; themes are similar.


注意如果你正将一个主题或者插件国际化,你应该使用一个"文本域"。更多关于怎样国际化一个插件的内容的信息,请看看[[WordPress:Writing a Plugin|编写一个插件]];主题国际化的操作也类似。
注意如果你正将一个主题或者插件国际化,你应该使用一个"文本域"。更多关于怎样国际化一个插件的内容的信息,请看看[[WordPress:Writing a Plugin|编写一个插件]];主题国际化的操作也类似。
The gettext framework takes care of most of WordPress. However, there are a few places in the WordPress distribution where gettext cannot be used -- see [[WordPress:Files For Direct Translation]] for more information on how to translate these spots.
Gettext框架照顾到了大部分的WordPress。但是,WordPress版本中的某些部分不能使用gettext—更多关于怎样翻译这些部分的信息,请看看[[WordPress:Files For Direct Translation|关于直接翻译的文件]]。
Gettext框架照顾到了大部分的WordPress。但是,WordPress版本中的某些部分不能使用gettext—更多关于怎样翻译这些部分的信息,请看看[[WordPress:Files For Direct Translation|关于直接翻译的文件]]。
=== gettext files ===


=== gettext 文件 ===
=== gettext 文件 ===
There are three types of files used in the gettext translation framework. These files are used and/or generated by translation tools during the translation process, as follows:


Gettext翻译框架中使用了三种类型的文件。这些文件在翻译过程中,由翻译工具产生和/或者使用,如下:
Gettext翻译框架中使用了三种类型的文件。这些文件在翻译过程中,由翻译工具产生和/或者使用,如下:


; POT (Portable Object Template) files : The first step in the localization process is that a program is used to search through the WordPress source code and pick out every message passed into a <tt>__()</tt> or <tt>_e()</tt> function. This list of English-language messages is put into a specially-formatted template file (POT file) that forms the basis of all translations. Generally, you can download a POT file for WordPress, so you shouldn't have to generate your own. Separate POT files can also be made for themes and plugins, if the theme/plugin developer has enclosed all text in <tt>__()</tt> or <tt>_e()</tt> functions.
;POT(轻便目标模板)文件:本地化过程中的第一步是使用一个程序来搜索WordPress源代码并且找出通过<tt>__()</tt> or <tt>_e()</tt>函数的每个message。这个英语message列表被输进一个特别格式的模板文件(POT文件),这个文件形成了翻译的基础。一般来说,你可以为WordPress下载一个POT文件,这样你就不要制造一个自己的POT文件了。如果主题/插件开发者将所有的文本包含在<tt>__()</tt> 或者<tt>_e()</tt>函数中,主题和插件也可以使用分开的POT文件。
 
;POT(轻便目标模板)文件:本地化过程中的第一步是使用一个程序来搜索WordPress源代码并且找出通过<tt>__()</tt> or <tt>_e()</tt>函数的每个message。这个英语message列表被输进一个特别格式的模板文件(POT文件),这个文件形成了翻译的基础。一般来说,你可以为WordPress下载一个POT文件,这样你就不要制造一个自己的POT文件了。如果主题/插件开发者将所有的文本包含在<tt>__()</tt> 或者<tt>_e()</tt>函数中,主题和插件也可以使用分开的POT文件。
 
; PO (Portable Object) files : The second step in the localization process is that the translator translates all the messages from the POT file into the target language, and saves both English and translated messages in a PO file.


:PO(轻便对象)文件:本地化过程的第二步是翻译者将POT文件中的所有内容翻译为目标语言,并且在一个PO文件中保存英语和翻译好的内容。
:PO(轻便对象)文件:本地化过程的第二步是翻译者将POT文件中的所有内容翻译为目标语言,并且在一个PO文件中保存英语和翻译好的内容。


 
;MO(机器对象)文件:本地化过程的最后一步是,PO文件在一个程序中运行,这个程序将PO文件转变为最优化的机器可读的二进制文件(MO文件)。将翻译汇编为机器代码来使得本地化程序运行时候,能够更快地重新找到翻译。
; MO (Machine Object) files : The final step in the localization process is that the PO file is run through a program that turns it into an optimized machine-readable binary file (MO file). Compiling the translations to machine code makes the localized program much faster in retrieving the translations while it is running.
 
;MO(机器对象)文件:本地化过程的最后一步是,PO文件在一个程序中运行,这个程序将PO文件转变为最优化的机器可读的二进制文件(MO文件)。将翻译汇编为机器代码来使得本地化程序运行时候,能够更快地重新找到翻译。
 
== Translation Tools ==


== 翻译工具==
== 翻译工具==
There are various tools available to aid in translating. You may use whichever you prefer.


有不同的工具能够辅助翻译。你可以使用任何你喜欢的翻译工具。
有不同的工具能够辅助翻译。你可以使用任何你喜欢的翻译工具。
; [https://translations.launchpad.net/ Launchpad] :The Ubuntu Linux project has a web site that allows you to translate messages without even looking at a PO or POT file, and export directly to a MO.


; [https://translations.launchpad.net/ Launchpad] : Ubuntu Linux项目有一个网站能够使你不看PO或者PO文件,就可以翻译内容,并且直接将翻译内容导出到MO。
; [https://translations.launchpad.net/ Launchpad] : Ubuntu Linux项目有一个网站能够使你不看PO或者PO文件,就可以翻译内容,并且直接将翻译内容导出到MO。
: ''Note: many translators have found Rosetta to be a good starting point, but once it comes time to proofread the entire list of translations, many have opted to switch hand-editing the PO file or using a program like poEdit or KBabel, since the Rosetta UI lacks a search feature and other things that become essential when proofreading and editing.''


:''注: 许多翻译人员发现Rosetta是个很好的出发点,但是如果要校正整个翻译内容,许多翻译者开始选择手工编辑PO文件或者使用一个程序像poEdit或者KBabel,因为Rosetta缺少一个搜索功能和其它对于校正和编辑来说至关重要的功能。''
:''注: 许多翻译人员发现Rosetta是个很好的出发点,但是如果要校正整个翻译内容,许多翻译者开始选择手工编辑PO文件或者使用一个程序像poEdit或者KBabel,因为Rosetta缺少一个搜索功能和其它对于校正和编辑来说至关重要的功能。''
; [http://pootle.locamotion.org/projects/wordpress/ Pootle] :An open source web-based translation system.  The server hosted at Locamotion.org currently has Wordpress translation enabled on it.


; [http://pootle.locamotion.org/projects/wordpress/ Pootle] :一个开放源码,以网络为基础的翻译系统。服务器托管在Locamotion.org当然拥有WordPress翻译。
; [http://pootle.locamotion.org/projects/wordpress/ Pootle] :一个开放源码,以网络为基础的翻译系统。服务器托管在Locamotion.org当然拥有WordPress翻译。
;[http://www.poedit.net/ poEdit] :An open source program for Windows, Mac OS X and UNIX/Linux which provides an easy-to-use GUI for editing PO files and generate MO files.


;[http://www.poedit.net/ poEdit] :Windows,Mac OS X和UNIX/Linux的一个开放源码程序,提供一个便于使用的GUI来编辑PO文件并且产生MO文件。
;[http://www.poedit.net/ poEdit] :Windows,Mac OS X和UNIX/Linux的一个开放源码程序,提供一个便于使用的GUI来编辑PO文件并且产生MO文件。
;[http://i18n.kde.org/tools/kbabel/ KBabel] :Another open source PO editing program for the KDE window manager on Linux.


;[http://i18n.kde.org/tools/kbabel/ KBabel] :Linux上的KDE窗口管理器的另一个开放源码PO编辑程序。
;[http://i18n.kde.org/tools/kbabel/ KBabel] :Linux上的KDE窗口管理器的另一个开放源码PO编辑程序。
;[http://www.gnu.org/software/gettext/ GNU Gettext] :The official Gettext tools package contains command-line tools for creating POTs, manipulating POs, and generating MOs. For those comfortable with a command shell.


;[http://www.gnu.org/software/gettext/ GNU Gettext] :官方的Gettext工具包包含了创建POTs,操作Pos,和产生MOs的命令行工具。那些适合于一个命令行shell。
;[http://www.gnu.org/software/gettext/ GNU Gettext] :官方的Gettext工具包包含了创建POTs,操作Pos,和产生MOs的命令行工具。那些适合于一个命令行shell。


=== Translating With Launchpad ===


=== 用Launchpad翻译 ===
=== 用Launchpad翻译 ===
We have a separate page with [[WordPress:Translating_WordPress_with_Launchpad|instructions for translating WordPress at Launchpad.]]


我们有一个单独的页面关于[[WordPress:Translating_WordPress_with_Launchpad|在Lanchpad上翻译WordPress的指示说明。]]
我们有一个单独的页面关于[[WordPress:Translating_WordPress_with_Launchpad|在Lanchpad上翻译WordPress的指示说明。]]
=== Translating With Pootle (at Locamotion.org) ===
=== 用Pootle翻译(在Locamotion.org) ===
=== 用Pootle翻译(在Locamotion.org) ===


# [http://pootle.locamotion.org/register.html Register an account] at the Pootle server, and send an e-mail to [http://codex.wordpress.org/Special:Emailuser/Leuce one of the admins] to add your language
# 在Pootle服务器上[http://pootle.locamotion.org/register.html 注册一个帐户],并且向[http://codex.wordpress.org/Special:Emailuser/Leuce 其中的一位管理员]发送电子邮件,添加你的语言。
 
#在Pootle服务器上[http://pootle.locamotion.org/register.html 注册一个帐户],并且向[http://codex.wordpress.org/Special:Emailuser/Leuce 其中的以为管理员]发送电子邮件,添加你的语言。
 
# Before trying to translate anything, remember to [http://pootle.locamotion.org/login.html log in] to Pootle.  Content can sometimes be viewed and suggestions can sometimes be entered even if a visitor is not logged in, but one can only translate if logged in.
 
#在试着翻译任何内容之前,记住[http://pootle.locamotion.org/login.html登录] 到 Pootle。访客没有登录的时候,有时候能够阅读或者提出建议,但是只有登录后,才能够翻译。
 
# Visit the WordPress page for your language.  For example, the Afrikaans page is at [http://pootle.locamotion.org/af/wordpress/ pootle.locamotion.org/af/wordpress/] (remember the trailing slash).
# Click "Show Editing Functions".
 
#访问WordPress页面,查找你的语言。例如,Afrikaans页面在[http://pootle.locamotion.org/af/wordpress/ pootle.locamotion.org/af/wordpress/](记住拖尾的斜线)。
#点击"显示编辑功能"。


# Click "Quick Translate" to edit only untranslated and fuzzy strings, or click "Translate All" to edit all strings.
# 在试着翻译任何内容之前,记住[http://pootle.locamotion.org/login.html登录] 到 Pootle。访客没有登录的时候,有时候能够阅读或者提出建议,但是只有登录后,才能够翻译。
# 访问WordPress页面,查找你的语言。例如,Afrikaans页面在[http://pootle.locamotion.org/af/wordpress/ pootle.locamotion.org/af/wordpress/](记住拖尾的斜线)。
# 点击 "显示编辑功能"


#点击"快速翻译",编辑没有翻译的,模糊的字符串,或者点击"翻译所有的",编辑所有的字符串。
#点击"快速翻译",编辑没有翻译的,模糊的字符串,或者点击"翻译所有的",编辑所有的字符串。


For the purpose of translating WordPress at locamotion.org, the single wordpress.pot file has been split up into smaller logical units.  The readme.html file is also available there, and so is a file containing all the strings that one would normally add to the PHP files manually.
需要在Locamotion.org上翻译WordPress,单一的wordpress.pot文件需要被分成更小的逻辑单位。这里也有readme.html文件,还有一个文件包含有所有的字符串,你可以动手将这些字符串添加到PHP文件。
 
需要在Locamotion.org上翻译WordPress,单一的wordpress.pot文件需要被分成更小的逻辑单位。这里也有readme.html文件,还有一个文件包含有所有的字符串,你可以将动手将这些字符串添加到PHP文件。
 
Also take a look at the Decathlon wiki page for WordPress, [http://translate.sourceforge.net/wiki/decathlon/wordpress here] and [http://translate.sourceforge.net/wiki/decathlon/wordpress_files here].


同时看看WordPress的Decathlon wiki页面,[http://translate.sourceforge.net/wiki/decathlon/wordpress here] 和[http://translate.sourceforge.net/wiki/decathlon/wordpress_files here]。
同时看看WordPress的Decathlon wiki页面,[http://translate.sourceforge.net/wiki/decathlon/wordpress here] 和[http://translate.sourceforge.net/wiki/decathlon/wordpress_files here]。
'''Merging your translations into wordpress.pot'''


'''将你的翻译融合到 wordpress.pot'''
'''将你的翻译融合到 wordpress.pot'''
Normally, with a Pootle server, the translator can download his chosen software's PO file at any time and submit it to his project.  However, because the original source file has been split into smaller units at pootle.locamotion.org, translators must manually merge their translations back into the wordpress.pot file before submitting it to WordPress.


一般来说,使用Pootle服务器,翻译人员能够在任何时候,下载自己选择的软件的PO文件,可以将这个文件递交到翻译项目中。然而,由于原始的源文件在pootle.locamotion.org上被分割为更小的单元,翻译人员必须动手将这些翻译结合,返回到wordpress.pot文件,然后再递交给WordPress。
一般来说,使用Pootle服务器,翻译人员能够在任何时候,下载自己选择的软件的PO文件,可以将这个文件递交到翻译项目中。然而,由于原始的源文件在pootle.locamotion.org上被分割为更小的单元,翻译人员必须动手将这些翻译结合,返回到wordpress.pot文件,然后再递交给WordPress。
# Download the [http://svn.automattic.com/wordpress-i18n/pot/trunk/wordpress.pot official WordPress POT file].


#下载[http://svn.automattic.com/wordpress-i18n/pot/trunk/wordpress.pot 官方的 WordPress POT文件]。
#下载[http://svn.automattic.com/wordpress-i18n/pot/trunk/wordpress.pot 官方的 WordPress POT文件]。
# Download and install the [http://translate.sourceforge.net/wiki/toolkit/installation Translate Toolkit] on your computer.
#在你的电脑上下载并且安装[http://translate.sourceforge.net/wiki/toolkit/installation 翻译Toolkit]。
#在你的电脑上下载并且安装[http://translate.sourceforge.net/wiki/toolkit/installation 翻译Toolkit]。
# Download the translated or partially translated PO files from the Pootle server.  You can download them one by one or you can download them in a ZIP file (see options on the web site).  Normally you don't need to be logged in at Poolte to download the PO files that translators in your language have translated.
#从Pootle服务器上下载翻译好的或者部分翻译好的PO文件。你可以一个个地下载这些文件或者将这些文件解压再下载(请看看网站上的选项)。一般来说,你不需要登录到Pootle上下载已经翻译为你的母语的PO文件。
#从Pootle服务器上下载翻译好的或者部分翻译好的PO文件。你可以一个个地下载这些文件或者将这些文件解压再下载(请看看网站上的选项)。一般来说,你不需要登录到Pootle上下载已经翻译为你的母语的PO文件。


# First, combine the PO files into a single translation memory (because it is easier to do subsequent steps with a single file than with several files), and execute the following from the command line: '''po2tmx -l xx -i pofiles -o xx.tmx''' where "xx" is your target language code.  This will create a TMX translation memory file called xx.tmx.
# First, combine the PO files into a single translation memory (because it is easier to do subsequent steps with a single file than with several files), and execute the following from the command line: '''po2tmx -l xx -i pofiles -o xx.tmx''' where "xx" is your target language code.  This will create a TMX translation memory file called xx.tmx.


#首先,将PO文件结合到一个单一的翻译存储器中(因为使用单一的文件而不是多个文件,更容易执行接下来的步骤),并且从命令行中执行下面的内容:'''po2tmx -l xx -i pofiles -o xx.tmx''' "xx"是你的目标语言代码的位置。  这会创建一个 TMX 翻译记忆文件,称为 called xx.tmx。
#首先,将PO文件结合到一个单一的翻译存储器中(因为使用单一的文件而不是多个文件,更容易执行接下来的步骤),并且从命令行中执行下面的内容:'''po2tmx -l xx -i pofiles -o xx.tmx''' "xx"是你的目标语言代码的位置。  这会创建一个 TMX 翻译记忆文件,称为 xx.tmx。


# Second, pre-translate the WordPress POT file using the translation memory.  To do this, execute the following from the command line: '''pot2po --tm=xx.tmx -i wordpress.pot -o wordpress_xx.po'''. This will create a PO file for your language called wordpress_xx.po.
# Second, pre-translate the WordPress POT file using the translation memory.  To do this, execute the following from the command line: '''pot2po --tm=xx.tmx -i wordpress.pot -o wordpress_xx.po'''. This will create a PO file for your language called wordpress_xx.po.

2008年8月8日 (五) 11:04的版本

国际化地方化是术语,用来描述使WordPress(和其它这样的项目)以英语以外的其它语言显示,供不同地区,持不同方言和地方特色的网民使用。

将这个软件本地化需要两个步骤。第一步是软件的开发者提供一个机制和方法来最终地翻译软件和界面来适应本地的特点和用户的语言。WordPress开发者已经完成了这一步,因此从理论上来讲,WordPress可以在任何语言背景中使用。


第二步就是真正地本地化,网页上的文本和其它的设置都翻译好了,并且符合其它的语言和文化习惯,并且使用了软件开发者指定的构架。WordPress已经被本地化翻译为许多种语言(更多的信息,请看看英语外其它语言的WordPress)。

这篇文章解释了翻译者(双语或者多个语言的WordPress用户)怎样才能将WordPress本地化为更多的语言。

翻译 WordPress

在你开始翻译WordPress之前,查看英语外其它语言的WordPress (以及那里引用的资源)是否已有了将WordPress翻译为你的语言的版本。也有可能每个人或者(一个组)已经开始将WordPress翻译为你的母语,但是他们还没有翻译完。要找到这样的信息,订阅wp-polyglots mailing list,介绍你自己,并且问问有没有什么人正将WordPress翻译为你的母语。也有一个本地化小组正在形成的本地化小组列表,你可以查看这个列表看看翻译是不是正在进行。

资格

假如WordPress还没有翻译为你的语言或者有人正在翻译,你可能想要作为志愿者来一起将WordPress翻译为你的母语,下面是你所需要的资格:

  • 你必须真正能够运用双语—对英语和你要翻译成的语言非常熟练。对两种语言掌握不透,会使得翻译对你来讲变得很难,或者你翻译后的WordPress版本,本地人看不懂。
  • 你需要熟悉PHP,因为你有时候需要通读WordPress编码来领会翻译这个信息的最好的方法。
  • 你应该熟悉人类语言构造:名词,动词,冠词等等,每种词的不同类型,并且能够识别这些词在不同的英语语境中的意思。

关于本地化

本地化是指语言与当地方言之间的结合。一般来说,本地化是指国家本地化,如葡萄牙语(葡萄牙),葡萄牙语(巴西)。

你可以将WordPress翻译为任何国家的语言,甚至是其它种类的英语,如加拿大英语或者澳大利亚英语,来适应当地的拼写和习惯用法。

WordPress默认语言是美国英语。

本地化技术

WordPress的开发者选择使用GNU gettext本地化框架来提供WordPress本地化的基本结构。Gettext是一个成熟的,广泛使用的,软件翻译模框架,而且是免费软件领域/开放源码本地化的实际标准。

gettext使用消息标准的翻译—就是说,显示给用户的每个"消息"都是单个翻译的,不管这个消息是一段话还是一个单词。在WordPress中,WordPress PHP 文件通过两个PHP函数产生,翻译,并且使用这样的"消息"。当消息作为参数传给另一个函数的时候,会用到__();使用_e()直接在网页上写信息。更多的关于这两个函数的详细信息:

__($message)
搜索翻译$message的本地化模块,并且将翻译传递给PHP返回申明。如果没有找到$message的翻译,只会返回$message
_e($message)
搜索翻译$message的本地化模块,并且将翻译传递给PHPecho申明。如果没有找到$message的翻译,只会echoes$message

注意如果你正将一个主题或者插件国际化,你应该使用一个"文本域"。更多关于怎样国际化一个插件的内容的信息,请看看编写一个插件;主题国际化的操作也类似。 Gettext框架照顾到了大部分的WordPress。但是,WordPress版本中的某些部分不能使用gettext—更多关于怎样翻译这些部分的信息,请看看关于直接翻译的文件

gettext 文件

Gettext翻译框架中使用了三种类型的文件。这些文件在翻译过程中,由翻译工具产生和/或者使用,如下:

POT(轻便目标模板)文件:本地化过程中的第一步是使用一个程序来搜索WordPress源代码并且找出通过__() or _e()函数的每个message。这个英语message列表被输进一个特别格式的模板文件(POT文件),这个文件形成了翻译的基础。一般来说,你可以为WordPress下载一个POT文件,这样你就不要制造一个自己的POT文件了。如果主题/插件开发者将所有的文本包含在__() 或者_e()函数中,主题和插件也可以使用分开的POT文件。

:PO(轻便对象)文件:本地化过程的第二步是翻译者将POT文件中的所有内容翻译为目标语言,并且在一个PO文件中保存英语和翻译好的内容。

MO(机器对象)文件:本地化过程的最后一步是,PO文件在一个程序中运行,这个程序将PO文件转变为最优化的机器可读的二进制文件(MO文件)。将翻译汇编为机器代码来使得本地化程序运行时候,能够更快地重新找到翻译。

翻译工具

有不同的工具能够辅助翻译。你可以使用任何你喜欢的翻译工具。

Launchpad
Ubuntu Linux项目有一个网站能够使你不看PO或者PO文件,就可以翻译内容,并且直接将翻译内容导出到MO。

注: 许多翻译人员发现Rosetta是个很好的出发点,但是如果要校正整个翻译内容,许多翻译者开始选择手工编辑PO文件或者使用一个程序像poEdit或者KBabel,因为Rosetta缺少一个搜索功能和其它对于校正和编辑来说至关重要的功能。

Pootle
一个开放源码,以网络为基础的翻译系统。服务器托管在Locamotion.org当然拥有WordPress翻译。
poEdit
Windows,Mac OS X和UNIX/Linux的一个开放源码程序,提供一个便于使用的GUI来编辑PO文件并且产生MO文件。
KBabel
Linux上的KDE窗口管理器的另一个开放源码PO编辑程序。
GNU Gettext
官方的Gettext工具包包含了创建POTs,操作Pos,和产生MOs的命令行工具。那些适合于一个命令行shell。


用Launchpad翻译

我们有一个单独的页面关于在Lanchpad上翻译WordPress的指示说明。

用Pootle翻译(在Locamotion.org)

  1. 在Pootle服务器上注册一个帐户,并且向其中的一位管理员发送电子邮件,添加你的语言。
  1. 在试着翻译任何内容之前,记住[1] 到 Pootle。访客没有登录的时候,有时候能够阅读或者提出建议,但是只有登录后,才能够翻译。
  2. 访问WordPress页面,查找你的语言。例如,Afrikaans页面在pootle.locamotion.org/af/wordpress/(记住拖尾的斜线)。
  3. 点击 "显示编辑功能"。
  1. 点击"快速翻译",编辑没有翻译的,模糊的字符串,或者点击"翻译所有的",编辑所有的字符串。

需要在Locamotion.org上翻译WordPress,单一的wordpress.pot文件需要被分成更小的逻辑单位。这里也有readme.html文件,还有一个文件包含有所有的字符串,你可以动手将这些字符串添加到PHP文件。

同时看看WordPress的Decathlon wiki页面,herehere

将你的翻译融合到 wordpress.pot

一般来说,使用Pootle服务器,翻译人员能够在任何时候,下载自己选择的软件的PO文件,可以将这个文件递交到翻译项目中。然而,由于原始的源文件在pootle.locamotion.org上被分割为更小的单元,翻译人员必须动手将这些翻译结合,返回到wordpress.pot文件,然后再递交给WordPress。

  1. 下载官方的 WordPress POT文件
  2. 在你的电脑上下载并且安装翻译Toolkit
  3. 从Pootle服务器上下载翻译好的或者部分翻译好的PO文件。你可以一个个地下载这些文件或者将这些文件解压再下载(请看看网站上的选项)。一般来说,你不需要登录到Pootle上下载已经翻译为你的母语的PO文件。
  1. First, combine the PO files into a single translation memory (because it is easier to do subsequent steps with a single file than with several files), and execute the following from the command line: po2tmx -l xx -i pofiles -o xx.tmx where "xx" is your target language code. This will create a TMX translation memory file called xx.tmx.
  1. 首先,将PO文件结合到一个单一的翻译存储器中(因为使用单一的文件而不是多个文件,更容易执行接下来的步骤),并且从命令行中执行下面的内容:po2tmx -l xx -i pofiles -o xx.tmx "xx"是你的目标语言代码的位置。 这会创建一个 TMX 翻译记忆文件,称为 xx.tmx。
  1. Second, pre-translate the WordPress POT file using the translation memory. To do this, execute the following from the command line: pot2po --tm=xx.tmx -i wordpress.pot -o wordpress_xx.po. This will create a PO file for your language called wordpress_xx.po.
  1. 其次,先前翻译的WordPress POT文件使用了翻译记忆。要实现这一点,请从命令行中执行以下的:pot2po --tm=xx.tmx -i wordpress.pot -o wordpress_xx.po。会为你的语言创建一个PO文件,称为wordpress_xx.po。
  1. Lastly, do a word/string count on your PO file to see how much of it is translated, fuzzy and untranslated, using the following from the command line: pocount wordpress_xx.po
  1. 最后,在你的PO文件上做一个单词/字符串统计,看看多少已经翻译好了,还有多少较模糊,没有翻译,从命令行中使用:pocount wordpress_xx.po

If all the PO files were 100% translated, the final wordpress_xx.po file will also be 100% translated. If some strings were not translated in the PO files, the pot2po command might cause some fuzzy translations in wordpress_xx.po (this is not a bad thing).

如果所有的PO文件都翻译完了,最后的wordpress_xx.po也全部翻译完了。如果PO文件中的一些字符串还没有翻译,pot2po命令可能导致wordpress_xx.po中出现一些模糊的翻译(这并不是件坏事)。

Translating With poEdit

用poEdit翻译

  1. Download and install poEdit
  1. 下载并且安装poEdit
  1. Download the official WordPress POT file right|thumb|100px|The poEdit screen
  1. 下载官方 WordPress POT 文件 right|thumb|100px| poEdit 界面
  1. Open the file in poEdit.
  1. 在poEdit中打开文件。
  1. (See Image) The box labeled (1) is the original message (in English) from the POT file. The box labeled (2) is where you add your translation. Boxes labeled (3) and (4) are used for adding comments about the messages. These come in handy if you are working with a team of translators and would like to pass around ideas through the PO file.
  1. (看图像)标为(1)的框是来自POT文件的原始内容(英语写的)。标记为(2)的框是你添加翻译的框。标记为(3)和(4)的框是用来添加关于内容的评论。如果你与一组翻译人员合作,并且想在PO文件上交流看法,这些框迟早有用。
  1. Go to File → Save as… to save your translations in a PO file.
  1. 进入文件 → 保存 as…在一个PO文件中保存你的翻译。
  1. When you are finished translating, go to File → Save as… again to generate the MO file.
  1. 当你完成翻译后,进入文件 → 保存 as…再次地产生一个MO文件。
  1. Or you can set your poEdit to always compile a MO file when saving changes by clicking File → Preferences and on the Editor tab check the Automatically compile .mo file on save box.
  1. 或者你可以将你的poEdit设置为当点击文件 → 喜好来保存变化的时候,总是编译一个MO文件而且在编辑 符上选中在保存框中自动编辑.mo 文件

Translating With KBabel

用KBabel 翻译

This section is incomplete. 这个部分还未完成。

  1. Download the official WordPress POT file
  2. 下载官方的 WordPress POT 文件
  3. Open the file in KBabel
  1. 在KBabel中打开文件

Translating With Gettext Tools

用 Gettext工具翻译

  1. Download the official WordPress POT file
  1. 下载官方 WordPress POT文件


  1. Open the file in your favorite text editor
  1. 在你最喜爱的文本编辑器中打开文件。


  1. Update the header information
  1. 更新标头信息
  1. Translate the messages
  1. 翻译内容


  1. Save the file with a .po file extension
  1. 用.po文件扩展名来保存文件


  1. Issue msgfmt -o filename.mo filename.po
  1. 发行msgfmt -o filename.mo filename.po

The PO File Header

PO 文件标头

At the beginning of the PO file is something called the header. This gives information about what package and version the translation is for, who the translator was, and when it was created. Certain portions of this header should be universal for all WordPress translations:

在PO文件的开始部分,称为标头。这个标头给出了翻译是关于哪个版本的软件包的,翻译人员是谁,以及翻译是何时创建的。这个标头的某些部分对于所有的WordPress翻译都是通用的:

# LANGUAGE (LOCALE) translation for WordPress.
  1. WordPress语言(本地化)翻译。
# Copyright (C) YEAR WordPress contributors.
  1. 版权(C) YEAR WordPress 投稿者。
# This file is distributed under the same license as the WordPress package.
  1. 这个文件发行的许可证与WordPress软件包的相同。
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
  1. 第一个作者 <EMAIL@ADDRESS>, YEAR.


#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: WordPress VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-02-27 17:11-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"


#, fuzzy
msgid ""
msgstr ""
"Project-Id-版本: WordPress 版本\n"
"Report-Msgid-Bugs-To: \n"
"POT-创建-日期: 2005-02-27 17:11-0600\n"
"PO-修订-日期: YEAR-MO-DA HO:MI+ZONE\n"
"最后的-翻译人员: 全名<EMAIL@ADDRESS>\n"
"语言-小组: 语言 <LL@li.org>\n"
"MIME-版本: 1.0\n"
"内容-形式: text/plain; charset=CHARSET\n"
"内容-翻译-编码: 8bit\n"


Fill in the rest of the capitalized text with the appropriate values.

用适当值填上剩下的大些字母文本部分。


Message Format

内容格式

The remainder of the file will be in a format as follows:

文件的剩余部分会是以下的格式:

#: wp-comments-post.php:13
msgid "Sorry, comments are closed for this item."
msgstr ""
#: wp-comments-post.php:13
msgid "对不起, 这篇文章不能够评论。"
msgstr ""
#: wp-comments-post.php:29
msgid "Sorry, you must be logged in to post a comment."
msgstr ""
#: wp-comments-post.php:29
msgid "对不起,你登录后,才能够发表评论。"
msgstr ""
#: wp-comments-post.php:35
msgid "Error: please fill the required fields (name, email)."
msgstr ""
  1. wp-comments-post.php:35
msgid "错误: 请填上必须的内容 (姓名,电子邮件)。"
msgstr ""

The first line of each message contains the location of the message in the WordPress code. In the case of these messages, they're all located in wp-comments-post.php, on lines 13, 29, and 35, respectively. Occasionally you will come across a message for which you will need to check its context; look at the appropriate line or lines in the WordPress core, and you should be able to figure out when and where the message is displayed, and even reproduce it yourself using your web browser. Some messages will also appear with the same text in multiple locations; in that case, there may be more than one line giving a file and line location.


每个内容的第一行包括了这个内容在WordPress编码中处于什么位置。这些消息内容都位于wp-comments-post.php,分别在第13,29,和第35行。有时候,你看到一个消息内容,你需要查看这个内容的语境;查看WordPress核心中的某行或者某些行,你就会了解消息内容应该什么时候显示,显示在什么位置,甚至还知道使用你的网络浏览器来复制这个消息内容。有的消息内容会出现在同一个文本的多处;这样肯定有多行给出了一个文件和一行的位置。


The next line, msgid, is the source message. This is the string that WordPress passes to its __() or _e() functions, and the message you will need to translate.

下一行,msgid,是 message。WordPress正是将这个命令行发送到__()或者 _e()函数,而且你需要翻译这个message。

The final line, msgstr, is a blank string where you will fill in your translation.

最后一行,msgstr,是一个空白的命令行,你需要在这个命令行上填上你的翻译。

Here's how the same few lines would look after being translated, using the French (France) locale as an example:

下面是几个相同的行在翻译之后,是怎样的,使用法语 (法国) 本地化来作为一个例子:

#: wp-comments-post.php:13
msgid "Sorry, comments are closed for this item."
msgstr "L'ajout de commentaire n'est pas ou plus possible pour cet article."
#: wp-comments-post.php:13
msgid "对不起,这篇文章的评论功能已经关闭了。"
msgstr "L'ajout de commentaire n'est pas ou plus possible pour cet article."
#: wp-comments-post.php:29
msgid "Sorry, you must be logged in to post a comment."
msgstr "Vous devez être connecté pour rédiger un commentaire."


  1. wp-comments-post.php:29
msgid "对不起,你登录后才能够发表评论。"
msgstr "Vous devez être connecté pour rédiger un commentaire."


#: wp-comments-post.php:35
msgid "Error: please fill the required fields (name, email)."
msgstr "Erreur : veuillez remplir les champs obligatoires vides (nom, e-mail)."
  1. wp-comments-post.php:35
msgid "错误:请填上必要的内容 (姓名,电子邮件)。"
msgstr "Erreur : veuillez remplir les champs obligatoires vides (nom, e-mail)."
Note: see [[WordPress:#Character_Encodings|Character encodings]] and [[WordPress:#HTML_Character_Entities|HTML character entities]] below for notes on when to use HTML character entities in translation.
注: 请看看下面的 [[WordPress:#Character_Encodings|字符集编码]][[WordPress:#HTML_Character_Entities|HTML 字符集实体]] 关于怎样在翻译中使用 HTML 字符实体。

Types of messages

messages 的类型

Labels

标签

Labels are often used in the context of HTML <label>, <legend>, <a>, or <select> tags. They are short and precise descriptors of the purpose of a UI element. These can be very difficult to translate at times, especially if they are single words, and if the word used in English can be interpreted as either a noun or imperative verb. With most labels you will need to do some searching through the code to find the context of its use before coming up with an appropriate translation.

Labels通常用在HTML<label>, <legend>, <a>, 或者<select>标签中。这些标签通常是一个UI元素的简单而精确的描述符。这些标签有时候可能很难翻译,特别如果标签是单词的话,而且如果单词可以被翻译为名词或者祈使句中的动词。拥有最多的labels的时候,你需要在编码中搜索一下,在找出编码在上下文中的用法,然后再决定合适地翻译编码。

Because so many of the messages are part of the WordPress administration interface, Labels are probably the most frequent type of message to translate.

因为这麽多的message是WordPress管理界面的一部分,Labels可能是翻译最频繁的message。

Examples

例子

msgid "Post"
msgstr "Artikkeli"

msgid "Post" msgstr "Artikkeli"

"Post" could be interpreted as an imperative verb, but in this context it's a noun. The noun form of "post" in English can be difficult to translate, and the most appropriate translation has been difficult for some teams to decide upon. Many translations use their language's equivalent to the English "Article," as this one does. (From the Finnish (Finland) translation.)

"post"可以被翻译为一个命令式的动词,但是在这个语境中,它是一个名词。"post"在英语中的名词形式,翻译会比较难,一些翻译小组很难决定哪个翻译最合适。许多翻译使用其英语的对等词"Article,"的确是这样的。(来自Finnish (Finland) 翻译。)


#: wp-login.php:79 wp-login.php:233 wp-register.php:166
#: wp-includes/template-functions-general.php:46
msgid "Register"
msgstr "रजिस्टर"

From the Hindi translation.

#: wp-admin/admin-functions.php:357
msgid "- Select -"
msgstr " - Dewis -"
  1. wp-login.php:79 wp-login.php:233 wp-register.php:166
#: wp-includes/template-functions-general.php:46
msgid "Register"
msgstr "रजिस्टर"

来自北印度语 翻译。

#: wp-admin/admin-functions.php:357
msgid "- Select -"
msgstr " - Dewis -"

Items like the surrounding dashes in this example can be eliminated or replaced if they might be confusing to users in your target locale, or if there are different established conventions for your locale. From the Welsh translation.

这个例子周围的破折号可能会被删除或者取消,如果这些破折号可能会使本地用户感到疑惑,或者你的本地化有不同的使用惯例。来自 威尔士语言翻译。

Informational Messages

Informational Messages

Another frequent type of message, the informational message is usually composed of full sentences, and conveys information or requests an action of the user. Since these tend to be longer than labels, they tend to be slightly easier to translate. However, with the longer messages comes more variation in the level of formality (or informality), which is something translators need to be aware of.

另一种通常的message形式,informational message通常是由完整的句子组成的,通常传递信息或者需要一个用户的执行活动。因为informational message比labels要长,这些message更容易翻译。然而,message越长,正式化(或者非正式化)的差别越大,翻译人员应该注意到这一点。

Examples

例子

#: wp-login.php:146
msgid "Your new password is in the mail."
msgstr "Вашата нова парола е в електронната ви поща."
  1. wp-login.php:146
msgid "你的新密码在邮件中。"
msgstr "Вашата нова парола е в електронната ви поща."

This particular message contains a modified English formulaic expression ("the check/cheque is in the mail"), which contributes to its informality. (From the Bulgarian (Bulgaria) translation.)

这个特别的 message包含了一个更改了的英语正式用语 ("邮件中的check/支票"), 这导致了非正式性用语。 (来自 保加利亚语 (保加利亚)翻译。)

#: wp-includes/functions.php:1636
msgid "<strong>Error</strong>: Incorrect password."
msgstr "<strong>FEL</strong>: Felaktigt lösenord."
  1. wp-includes/functions.php:1636
msgid "<strong>Error</strong>: Incorrect password."
msgstr "<strong>FEL</strong>: Felaktigt lösenord."

Error messages tend to be more formal, simply because they're short and concise. (From the Swedish (Sweden) translation.)

错误信息因为更加简短精确,倾向于更加地正式。 (来自瑞典语 (瑞典) 翻译。)

#: wp-includes/functions-post.php:467
msgid "Sorry, you can only post a new comment once every 15 seconds. Slow down cowboy."
  1. wp-includes/functions-post.php:467
msgid "对不起,你只能每隔十五秒才能够发表一个新的评论。慢点,伙计。 "
msgstr "Leider kannst du nur alle 15 Sekunden einen neuen Kommentar eingeben. Immer locker bleiben."

msgstr "Leider kannst du nur alle 15 Sekunden einen neuen Kommentar eingeben. Immer locker bleiben."

Of course, not all of them. (From the German (Germany) translation.)

当然,并不是所有的都那样。(来自德语(德国) 翻译。)

Strings with description

拥有描述的字符串

If a string contains a vertical bar |, the part on the right of | is a description. Its purpose is to help you translate the string, placing it in certain context or providing additional information.

如果一个字符串包含有一个竖线|,|右边的部分是一个描述。这个描述的目的在于帮助你翻译字符串,将字符串放到某个语境中,或者提供额外的信息。

Examples

例子

#: wp-includes/locale.php:186
msgid ""
"number_format_decimal_point|$dec_point argument for http://php.net/number_format, default is ."
msgstr ","
  1. wp-includes/locale.php:186
msgid ""
"number_format_decimal_point|$dec_point argument for http://php.net/number_format, default is ."
msgstr ","

The description suggest you look at a web page, in order to translate the string.

描述建议你如果要翻译字符串,就要查看一个网页。

Date and Time Locale Settings

时间和日期本地化设置

Rather than using PHP's built-in locale switching features, which is not configured for very many languages on most hosts, WordPress uses the gettext translation module to accomplish date and time translations and formatting. WordPress没有使用内置的本地化切换功能,大多数主机的许多语言都没有配置这个功能,WordPress使用了gettext翻译模块来完成时间和日期的翻译和格式。

WordPress translates the following:

WordPress翻译下面的内容:

Month names

月份名称

#: wp-includes/locale.php:42 wp-includes/locale.php:57
msgid "May"
msgstr "Květen"

(From the Czech (Czech Republic) translation.)

  1. wp-includes/locale.php:42 wp-includes/locale.php:57
msgid "五月"
msgstr "Květen"

(From the 捷克语 (捷克共和国) 翻译。)

Month abbreviations

月份缩写

  1. wp-includes/locale.php:57
msgid "May_May_abbreviation"
msgstr "Mag"
  1. wp-includes/locale.php:57
msgid "五月_五月_缩写"
msgstr "Mag"

Note the unusual msgid. These messages should NOT be translated literally: they are a hack to get around the fact that in English, the full name and abbreviation for May are the same, which Gettext would erroneously combine into one entry. (From the Italian (Italy) translation.)

注意不寻常的 msgid。 这些messages 应该直译: 它们破解了英语中的一个事实,全名和缩略名是相同的, Gettext 可能错误地将两个结合在一篇文章中。(来自意大利语(意大利) 翻译。)

Weekday Names

星期名称

#: wp-includes/locale.php:7
#: wp-includes/locale.php:18
#: wp-includes/locale.php:31
msgid "Tuesday"
msgstr "火曜日"

(From the Japanese (Japan) translation.)

  1. wp-includes/locale.php:7
#: wp-includes/locale.php:18
#: wp-includes/locale.php:31
msgid "星期二"
msgstr "火曜日"

(From the 日语 (日本)翻译。)

Weekday Abbreviations

星期缩写

#: wp-includes/locale.php:31
msgid "Tue"
msgstr "Уто"
  1. wp-includes/locale.php:31
msgid "Tue"
msgstr "Уто"

(From the Serbian (Serbia) translation.)

(来自塞尔维亚语言 (塞尔维亚) 翻译。)

Weekday Initials

星期词首大写

#: wp-includes/locale.php:18
msgid "T_Tuesday_initial"
msgstr "ti"
  1. wp-includes/locale.php:18
msgid "T_星期二_词首大写"
msgstr "ti"

The weekday initials are for WordPress's calendar feature, and use the same hack as the month abbreviations to get around the fact that in English Tuesday and Thursday share the same first letter. Not all locales use single-letter abbreviations for all days: in this example, Norwegian Bokmål uses an extra letter to distinguish tirsdag (Tuesday) and torsdag (Thursday). (From the Norwegian Bokmål (Norway) translation.)

星期首字母大写符合WordPress历法的特色,与月份缩略词使用同样的方法,以符合要求,因为在英语中星期二和星期四的首字母是一样的。并不是所有的本地化都是用对每个日期都使用单字母缩略词的形式:在这个例子中, 挪威语Bokmål使用一个额外的字母来区分 tirsdag (星期二)和torsdag (星期四)。(来自挪威语 Bokmål (挪威) 翻译。)

Date Formatting Strings

日期格式字符串

These are PHP date() formatting strings, and they allow you to change the formatting of the date and time for your locale.

这些是PHP 日期()格式字符串,而且这些字符串能够使你更改你的本地化的日期和时间的格式。

WordPress uses the translations elsewhere in the localization file for month names, weekday names, etc. This special string is for the selection of which elements to include in the date & time, as well as the order in which they're presented.

WordPress使用本地化文件其它地方的翻译来用于月份名称,星期名称,等等。这个特别的字符串可以选择哪个元素要包含在日期 &时间,和日期时间呈现的次序中。

Take this msgid from the theme.pot file:

theme.pot文件中取出这个msgid

#: archive.php:40 search.php:19 single.php:22
msgid "l, F jS, Y"
msgstr ""
  1. archive.php:40 search.php:19 single.php:22
msgid "l, F jS, Y"
msgstr ""

In English, this gets formatted as:

在英语中,这个的形式是:

Sunday, February 27th, 2005

2005,2月27日,星期天

However, different locales format their dates differently. In Danish, for example, dates are written:

然而,不同的本地化语言的日期形式是不同的,在丹麦语中,例如,日期写为:

søndag, 27. februar 2005

søndag, 27. februar 2005

To accomplish this, the msgid above would be translated to:

要做到这一点,上述的msgid应该被翻译为:

#: archive.php:40 search.php:19 single.php:22
msgid "l, F jS, Y"
msgstr "l, j. F Y"
  1. archive.php:40 search.php:19 single.php:22
msgid "l, F jS, Y"
msgstr "l, j. F Y"

To use another example, one way to format dates in Chinese and Japanese is as follows:

另一个例子,在汉语和日语中,日期的格式是:

2005年2月27日

2005年2月27日

This would be accomplished in the translation like this:

翻译中可以达到这个要求:

#: archive.php:40 search.php:19 single.php:22
msgid "l, F jS, Y"
msgstr "Y年n月j日"
  1. archive.php:40 search.php:19 single.php:22
msgid "l, F jS, Y"
msgstr "Y年n月j日"

Lastly, if you need to include literal alphabetic characters in your date format, as sometimes occurs in Spanish, you can backslash them:

最后,如果你的日期格式中需要包含字面意思的文字字符,就如西班牙语有时出现的那样,你可以在反斜线符号后面加上:

#: archive.php:40 search.php:19 single.php:22
msgid "l, F jS, Y"
msgstr "l j \d\e F \d\e Y "
  1. archive.php:40 search.php:19 single.php:22
msgid "l, F jS, Y"
msgstr "l j \d\e F \d\e Y "

This would output:

这回输出:

domingo 27 de febrero de 2005

domingo 27 de febrero de 2005

Translation via WordPress-PHP

通过WordPress-PHP 翻译

To translate your Date e.g. inside your plugin use the wp-function mysql2date(Dateformat, Datestring). It uses the month- and week-translations to return your date.

要翻译你的日期,例如,在你的插件中使用wp-函数mysql2date(Dateformat, Datestring)。这个使用月和星期翻译来返回你的日期。

Messages With Placeholders

占位符Messages

Many messages contain special PHP formatting placeholders, which allow the insertion of untranslatable dynamic content into the message after it is translated. The PHP placeholders come in two different formats:

许多message包含特别的PHP格式的占位符,这个允许翻译后,插入不可翻译的动态内容到message。PHP占位符拥有两种不同的格式:

%s
When only one placeholder is present, this marker is used.
%s
只有一个占位符呈现的时候,会使用这个标记。
%1$s, %2$s, %3$s, …
Numbered placeholders, which allow translations to rearrange the order of the placeholders in the string while maintaining the information each is replaced with.
%1$s, %2$s, %3$s, …
有限的占位符,允许翻译来重新地组织字符串中占位符的顺序,同时保持每个占位符所代表的信息。

Examples

例子

#: wp-login.php:116
msgid "The e-mail was sent successfully to %s's e-mail address."
msgstr "El e-mail fue enviado satisfactoriamente a la dirección e-mail de %s"
  1. wp-login.php:116
msgid "这个电子邮件成功地发送到了 %s的电子邮件地址。"
msgstr "El 电子邮件 fue enviado satisfactoriamente a la dirección e-mail de %s"


This message inserts the username of the user to which an email has been sent. (From the Spanish (Spain) translation.)

这个 message 插入了用户的用户名,电子邮件正是发送到这个用户名。(来自 西班牙语 (西班牙) 翻译。)

#: wp-admin/upload.php:96
#, php-format
msgid "File %1$s of type %2$s is not allowed."
msgstr "类型为%2$s的文件%1$s不允许被上传。"
  1. wp-admin/upload.php:96
#, php-format
msgid "File %1$s of type %2$s is not allowed."
msgstr "类型为%2$s的文件%1$s不允许被上传。"

This message reverses the order in which the file name and type are used in the translation. (From the Chinese (China) translation.)

这个message颠倒了翻译中文件名和类型是次序。(来自(中国)翻译。)

Tips for Good Translations

优秀的翻译小贴士

Don't translate literally, translate organically
Being bi- or multi-lingual, you undoubtedly know that the languages you speak have different structures, rhythms, tones, and inflections. Translated messages don't need to be structured the same way as the English ones: take the ideas that are presented and come up with a message that expresses the same thing in a natural way for the target language. It's the difference between creating an equal message and an equivalent message: don't replicate, replace. Even with more structural items in messages, you have creative license to adapt and change if you feel it will be more logical for, or better adapted to, your target audience.

;不要直译,要整体地翻译:要知道两个或者多个语言,毫无疑问你知道你所说的语言拥有不同的结构,韵律,语调和变形形式。翻译过的message不需要与英语语言结构相同:了解源语言的意思,然后以目标语言的习惯,将它以相同的意思表述出来。就如创建一个等同的message和一个对等的message之间的区别:不要复制原话,要翻译出来。即使message中有更多的结构内容,你要有创建性的思想,将这些结果更改,使其更加地适应你的本地化用户的习惯表述和逻辑。

Try to keep the same level of formality (or informality)
Each message has a different level of formality or informality. Exactly what level of formality or informality to use for each message in your target language is something you'll have to figure out on your own (or with your team), but WordPress messages (informational messages in particular) tend to have a politely informal tone in English. Try to accomplish the equivalent in the target language, within your cultural context.

;试着保持同等级别的正式性(或者非正式性):每个message有一个不同级别的正式性或者非正式性。你的目标语言中需要使用什么样的正式性或者非正式性,你需要自己决定(或者与你的小组一起决定),但是WordPress messages(特别是informational messages)倾向于使用一种客气的非正式的语调。试着在目标语言的语境中找到对等的语调。

Don't use slang or audience-specific terms
Some amount of terminology is to be expected in a blog, but refrain from using colloquialisms that only the "in" crowd will get. If the uninitiated blogger were to install WordPress in your language, would they know what the term means? Words like pingback, trackback, and feed are exceptions to this rule; they're terminology that are typically difficult to translate, and many translators choose to leave in English.

;不要使用俚语或者针对特别用户的术语:一些术语需要用在博客中,但是不可以使用在"in"人群所用的口语中。如果外行的写博客的人要使用你的语言来安装WordPress,他们会知道这些术语的意思吗?单词像pingback, trackback, 和feed是这个规则的例外;这些是特别难以翻译的术语,许多翻译人员选择将这些术语保留英文。

Read other software's localizations in your language
If you get stuck or need direction, try reading through the translations of other popular software tools to get a feel for what terms are commonly used, how formality is addressed, etc. Of course, WordPress has its own tone and feel, so keep that in mind when you're reading other localizations, but feel free to dig up UI terms and the like to maintain consistency with other software in your language.

;阅读你的母语中其它的软件的本地化:如果你遇到了麻烦或者需要指导,试着阅读其它流行软件工具的翻译,来摸索一些那些术语是经常使用的,用语有多正式,等等。当然,WordPress拥有自己的语调和氛围,因此当你阅读其它的本地化翻译的时候,要牢记这一点,但是可以自由地查找UI术语等等来与你的母语的其它软件中这些术语的翻译保持一致。

WordPress Localization Repository

WordPress 本地化知识库

The WordPress Localization Repository at http://svn.automattic.com/wordpress-i18n/ is a Subversion repository where official WordPress translations are maintained. Various teams collaborate on translations for their native language, and team maintainers commit updates and changes to the repository.

http://svn.automattic.com/wordpress-i18n/上的WordPress 本地化知识库是一个子版本 知识库这里保存了官方的WordPress翻译。不同的小组一起合作将WordPress翻译为他们的母语,而且小组维护人员使得知识库保持更新和变化。

Participating

加入

Participation in the repository is open to anyone. Simply subscribe to the wp-polyglots mailing list, introduce yourself, and let everyone know what translation you'd like to work on. If there is already a team for your language and locale, they'll let you know and you can join them. If not, you can either volunteer to be a maintainer for your language and locale, or simply contribute your localization and the repository maintainers will add it.

任何人都可以加入这个知识库。只要订阅wp-polyglots mailing list,介绍你自己,让他人知道你想要翻译什么。如果已经有一个你的母语翻译的小组,他们会通知你,让你加入。如果没有这样的小组,你可以志愿成为你的母语翻译维护人员,或者本地化人员,或者只是付出你的本地化翻译,知识库维护人员会添加你的翻译。

Guidelines and requirements

指导方针和要求

Note: these guidelines are subject to change as the system evolves; repository maintainers will be happy to assist you in updating the files you maintain in the repository should these guidelines change.

注: 随着系统的升级,这些指导方针会受系统变化的支配;如果指导方针改变了,知识库维护人员会非常乐意帮助你来更新你储存在知识库中的文件。

Character Encodings

字符编码

All localizations should have at least a UTF-8 version, but may optionally add versions in other character encodings popular for that locale.

所有的本地化翻译应该至少有一个UTF-8版本,但是可能会随意地在本地化翻译受欢迎的其它字符编码中添加版本。

PHP does not support Byte Order Markers (BOMs), so be sure the UTF-8 encoded files you contribute do not have them.

PHP不支持Byte Order Marker(BOMs),因此要确定你贡献的UTF-8编码的文件不包含有BOMs。

HTML Character Entities

HTML 字符实体

With a few exceptions (noted below), all translations should be written literally, rather than escaping accented and special characters with HTML character entities.

除了一些例外(下面所列出的),所有的内容都应该逐字翻译,不应该跳过重音节单词或者HTML字符实体上特别的字符。

Some characters must be escaped to avoid conflict with XHTML markup: angle brackets (&lt; and &gt;), and ampersands (&amp;). In addition, there are a few other characters better used escaped, such as non-breaking spaces (&nbsp;), angle quotes (&laquo; and &raquo;), curly apostrophes (&#8217;) and curly quotes.

一些字符必须要避免与XHTML标记相冲突:尖括号(&lt;&gt;), 和&符号 (&amp;)。此外,有一些更易于使用的字符,丢失了,例如non-breaking spaces(&nbsp;),angle quotes(&laquo;&raquo;), curly apostrophes (&#8217;)和curly quotes。

For more information about the W3C's best practices involving character encodings and character entities, see the following references:

关于W3C关于字符编码和字符实体的最好做法的更多的信息,请看看下面的参考:

Repository File Structure

知识库文件结构

The repository contains directories for each locale, which are named as follows: 知识库包含了每个本地化翻译的目录,这些目录命名为如下:

Within each locale's directory are the regular Subversion versioning directories: branches/, tags/, and trunk/.

在每个本地化翻译的目录中有正规的子版本译文目录:支部/, 标签/, 和枝干/。

Inside the appropriate versioning directory are the following subdirectories:

在合适的译文目录内部有以下的子目录。

messages/
messages/
  • messages/
    • kubrick


  • messages/
    • kubrick


This directory contains the Gettext MO and PO files for the locale. Message files are named after the locale name.

这个目录包含了本地化翻译的Gettext MO 和 PO文件。Message文件命名以locale名命名。

In the kubrick folder you should put the translation (using exactly the same PO/MO filename as above) of the i18n-ed default theme, residing at the wordpress-i18n svn repository. There is also another way of translating the default theme:

kubrick文件夹中,你应该将i18n-ed的翻译放到(使用与以上相同的PO/MO文件名)default theme, residing at the wordpress-i18n svn 知识库。还有另一种方式翻译默认主题:


dist/
dist/

This directory contains all files in the WordPress distribution that cannot be Gettexted, which have been translated into the target locale.

目录包含有所有的 WordPress 发行的,不能够被 Gettexted的所有文件,可以被翻译为本地化语言。

If the locale has only a UTF-8 translation of the files, the dist/ directory may be populated with them directly, and the structure within dist should mirror the structure of the wordpress root directory:

如果本地化翻译中只有一个文件的UTF-8翻译,dist/目录可能直接拥有许多内容,dist内部的结果应该反映wordpress根目录的结构:

  • dist/
    • license.html
    • readme.html
    • wp-config-sample.php
    • wp-admin/
      • install.php
      • upgrade.php



  • dist/
    • license.html
    • readme.html
    • wp-config-sample.php
    • wp-admin/
      • install.php
      • upgrade.php

If the locale contains more than just a UTF-8 character encoding, then dist/ should contain subdirectories for each encoding:

如果本地化翻译不止包含一个UTF-8字符编码,那么dist/应该包含每个编码的子目录:

  • dist/
    • UTF-8/
      • license.html
      • readme.html
      • wp-config-sample.php
      • wp-admin/
        • install.php
        • upgrade.php
    • ISO-8859-1/
  • dist/
    • UTF-8/
      • license.html
      • readme.html
      • wp-config-sample.php
      • wp-admin/
        • install.php
        • upgrade.php
    • ISO-8859-1/


theme/
主题/

It is better to translate the i18n-ed kubrick (see the messages/ part above), instead of using theme/.

最好翻译 i18n-ed kubrick (请看看上面的 messages/ 部分),而不是使用 主题/

Similarly to the dist/ dir, theme/ contains hard-translated theme files. If only a UTF-8 translation is present, the directory can be populated with subdirectories for each theme translated. These subdirectories contain all of the same files as the original theme (except that they're translated), and are named the same as the original theme:

与dist/dir类似,主题/包含很难翻译的主题文件。如果只呈现了一个UTF-8翻译,目录上可以有每个翻译好的主题的子目录。这些子目录包含了与原始主题相同的文件(只是这些文件已经翻译好了),而且与原始主题命名相同:

  • theme/
    • default/
      • 404.php
      • index.php
      • sidebar.php
      • images/




  • theme/
    • default/
      • 404.php
      • index.php
      • sidebar.php
      • images/


Just as with the dist/ directory, if there are multiple character encodings represented, theme/ should contain a subdirectory for each character encoding, which in turn would contain subdirectories for each theme translated.

正如dist/目录,如果呈现了多个字符编码,主题/应该包含每个字符编码的子目录,依次包含关于有翻译好的每个主题的子目录。

Using Localizations

使用本地化

In order to localize your installation of wordpress, create a directory named languages inside of wp-includes, if it does not already exist. Then grab the appropriate localization files from the Subversion Repository as described above. The main .mo file for the language should go inside the languages directory. Set WPLANG inside of wp-config.php to your chosen language. For example, if you wanted to use french, you would have:

为了要本地化安装你的wordpress,如果本地化还不存在,创建一个目录名为语言 而不是wp-包含。然后如上所述,从子版本知识库中提取一个适当的本地化文件。语言的main .mo文件应该在语言目录内部。在wp-config.php内部为你选择的语言,设置WPLANG。例如,如果你想使用法语,你就会有:

define ('WPLANG', 'fr_FR');
define ('WPLANG', 'fr_FR');

Troubleshooting

发现并解决问题

Rosetta won't export my translation as an MO file. It just says, "A system error occurred."
There is a syntax error in your translation that is preventing it from compiling to an MO. Download the PO instead and try compiling it manually with msgfmt. This will tell you which lines the errors are on so you can correct them by hand. If you don't have the GNU Gettext package installed, you can try opening the PO file in poEdit or KBabel to see if they will help you correct the errors, or you can email the wp-polyglots mailing list and ask for someone to debug it for you.

;Rosetta不会将我的翻译以一个MO文件导出。只是显示,"出现了一个系统错误。":你的翻译中有一个语法错误,阻止翻译汇编成一个MO。下载PO并且试着动手用msgfmt将它编译。这样你会得知哪行出现了错误,这样你可以动手更改这些错误。如果你没有安装一个GNU Gettext软件包,你可以试着在poEdit或者 KBabel中打开PO文件,看看那这些文件能否帮助你来更改错误,或者你可以发送电子邮件到wp-polyglots mailing list让其他人来帮助你解决程序错误。

Resources

资源

Ryan Boren's Localizing Plugins and Themes
Translating WordPress into another language (themes and plugins too)

Ryan Boren的插件和主题本地化
将WordPress翻译为英语外的其它语言 (主题和插件)