Help:Extension:翻译/离线翻译

From mediawiki.org
This page is a translated version of the page Help:Extension:Translate/Off-line translation and the translation is 38% complete.
Outdated translations are marked like this.

本页介绍了如何离线翻译。 如果您对此感兴趣,您可能已经知道Gettext PO文件是什么。 出于这个原因,我们将仅讨论如何在带有Translate扩展的wiki中使用它们。 否则,您可能对如何在线翻译的教程更感兴趣。

更一般地说,如果您的互联网连接速度非常慢或有限,或者离线工具不能没有,您可能不希望使用网页界面。 但请注意,翻译扩展程序是为协作过程设计的。 这意味着您不应长时间保持文件脱机,并且应始终在开始翻译之前下载新文件。 否则,您可能会与在wiki中工作的其他翻译人员发生冲突。

导出

您可以通过选择Special:Translate中的离线翻译导出,将任何消息组下载为Gettext PO文件。但某些站点可能已禁用这个。您应该在开始之前检查本地指南如何处理这些文件。

Although some message groups might have an export option, which exports translations in the native format of that group, and that format could be Gettext, those are not the files that can be used for off-line translation!

这些文件是标准的Gettext PO文件,包含一些额外信息。 The header contains some extra fields shown below; the msgctxt for each message contains an identifier that the Translate extension needs. Some editors are known to strip either the header comments or the msgctxt lines, so start with a small file to make sure that your editor does not remove these ― it's not funny to realize the editor was buggy after translating hundreds of messages that you cannot import back into the online system! 消息文档会导出为翻译注释。

重要的标题字段:

"X-Language-Code: nl\n"
"X-Message-Group: ext-abc\n"

在此示例中,“ext-abc”是消息组的名称。 For translatable pages, the corresponding message group has the name "page-" + the page name (i.e. for the page "Example", the header would contain the line "X-Message-Group: page-Example\n").

Example entry in a GetText .po file, translated here from English (on the "msgid" line) to German (on the "msgstr" line) :

#. [Wiki] This text is used on the history tab.
#. [Wiki] 

msgctxt "history_short"
msgid "History"
msgstr "Versionsgeschichte"

Notice the line starting by msgctxt: it briefly explains the context of usage for the message given in the next msgid line. Such msgctxt line is optional but recommended. After importing the .po file, this contextual text will be made visible to users of the Translate UI on the wiki, and it should be kept or updated when needed.

导入

不需要完全翻译文件。完全可以上传部分翻译的消息组。 导入这些文件有两种方式。

持有正确用户权限的用户可使用Special:ImportTranslations上传并导入翻译。 这个特殊页面会处理文件,显示更改,供用户导入。 For large files with lots of changes the importing might take multiple steps, as the processing time is limited.

Importing can also be done using a command line script in Translate/script/poimport.php. It's less flexible but can import everything in one go. It also needs intervention from someone with shell access to the server.

The way how imports of off-line translations are handled (or not) depends on your wiki.

Gettext编辑器

以下是一些可用于脱机编辑文件的工具。

POedit
Available for all platforms supporting the wxWidgets toolkit, tested on Unix with GTK+ and Windows.
WARNING: make sure you are using version 1.4.2 or above, otherwise "msgctxt" lines are dropped and your work cannot be processed.
; gtranslator : 可用于Unix和Linux平台上的GNOME桌面环境。
Can be used in the GNOME desktop environment on Unix and Linux platforms.
Lokalize
Uses the KDE 4 Desktop Environment on all platforms supporting it. Has a user wiki and online handbook
Translate Toolkit
Toolkit written in the python programming language which must be installed as well, usable on all platforms. Supports several other file formats as well.
Virtaal
Multi-format translation tool based on the toolkit above. Currently working in Windows and Linux.
OmegaT
Free tool for professional translators written in Java, requires Java installed; available on all platforms. Supports a variety of other file formats, glosssaries, fuzzy matching, and translation memories.
; Eazy PO : 小型程序,在Windows上运行,免安装。
Small program, runs on Windows, no installation required.
; Gorm PO file editor : 小巧而强大的程序,在Windows上运行,免安装,1.0版不能解析msgctxt标签。
Small powerful program, runs on Windows, no installation required, version 1.0 fails on msgctxt tags.
Better PO Editor
Available as source code for Windows, BSD, Unix, Linux, Mac OS X. Includes spell checker and Google Translate suggestions.
gted
Usable as a plugin in the Eclipse IDE under Linux, Windows and MAC OS X; embeds various tools.