帮助:扩展:翻译/页面翻译管理

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Help:Extension:Translate/Page translation administration and the translation is 58% complete.

Other languages:
Deutsch • ‎English • ‎Esperanto • ‎Kiswahili • ‎Lëtzebuergesch • ‎Zazaki • ‎català • ‎dansk • ‎español • ‎français • ‎italiano • ‎lietuvių • ‎polski • ‎português • ‎português do Brasil • ‎slovenčina • ‎svenska • ‎čeština • ‎беларуская (тарашкевіца)‎ • ‎русский • ‎українська • ‎العربية • ‎فارسی • ‎मराठी • ‎हिन्दी • ‎বাংলা • ‎中文 • ‎日本語 • ‎한국어

什么。页面翻译功能支持把 wiki 页面翻译为其他语言。意思是每种翻译的内容通常都等同于源页面。与之不同的是,例如在不同的维基百科中,不同语言的条目内容完全是独立的。一般假定为页面仅从一种主要语言翻译为其他语言,不过译者也可以利用其他存在的翻译。

为什么。如果不利用辅助工具,翻译大量页面到其他语言最好的情况也会成为耗时的事情,最糟糕时会变成无法管理的一团乱麻。通过页面翻译功能,您可以避免混乱并在翻译过程中保持结构清晰。核心方法是把源文本分割成更小的单元,在翻译时每个单元保持独立。把源文本分割成单元后,所有的改变都是独立的,译者只需更新源文本有变化单元的译文。同时也让译者可操作于可管理大小的单元或在后面的会话中继续,而不用一次性做完。

谁。页面翻译指南深入并且详细地说明了系统工作的原理,并提供了适用于大部分情况的最佳实践的建议。本页面专门提供给页面翻译管理员和编辑可译页面源文本的每个人的,即使后者无法访问批准翻译变化的管理功能。

翻译页面的生命力

角色。多人参与编写和翻译 wiki 页面的过程:最初有编者创建页面,有人纠正拼写错误,页面翻译管理员标记页面待翻译,译者翻译页面,有人修改了页面,翻译管理员标记这些修改为待译接着译者更新了译文。这些角色多少有些重合,不过无争议翻译的根本责任在于页面翻译管理员。他最开始决定页面是否适合翻译,确保片段分割合理及批准(或改正)变化。

预备。在翻译之前您必须编写内容。如果您未使用翻译扩展就完成了翻译,请参阅下面的有关迁移翻译的段落。如果您想快速完成大量翻译,确保原词条的完整与准确十分重要。在标记页面为待译前,让别人先校对过,如果可以的话,让语言专家把文本调整到更简洁清晰。生涩的词汇和难懂的句子会给志愿者的翻译产生障碍。标记也可能给译者带来问题,不过作为翻译管理员您可以去除这些问题,请参阅下面的有关标记处理的段落。通常情况下您对翻译的源内容的修改会要求强制更新所有的现有译文,所以最好等到页面内容稳定后再进行。另一方面,改变会发生,系统也能正常处理,因此请检查下面的有关处理变更的段落

加标签。当文本已经适合翻译时,每个人都可以把需要翻译的部分括在 <translate> 标签中并添加 <languages /> 栏到页面。后者在页面中增加了当前页面的所有译文列表及翻译完成百分率。这是表示存在译文的唯一提示。请参阅下面的加标记的具体方法。系统能检测到在可译页面包含的标签,且该页将会出现待译标记。如果您忘记加上闭标签或类似问题,它还会提示并无法保存。可译页面还会列出于 Special:PageTranslation 的等待标记部分。

标记。添加标签后,翻译管理员标记页面为待译状态。其界面的说明在页面翻译示例。翻译管理员的职责是确保分割合理、所加标签合适。如果在这期间内容改变了可以再次标记该页。请参阅下面的如何标记变化才能减小分裂。页面的标记开启了使用 MediaWiki作业队列的后台进程。该进程扫描每个翻译页面并重新生成:反映出翻译页面模板的变化并把过时翻译临时替换为源文本。反之,立即更新翻译界面。

变更。用户可以继续修改源页面的内容。在查看源语言页面时可以看到该变更,从标记为翻译的可译页面最新版本中提取了翻译单元后翻译页面中也可以看到:如果翻译了所有单元则会提示 100%,即使此时源页面发生了新变更。查看源语言的可译页面时您可以很容易看到未标记的变更:在页面靠上的位置会显示通告提示您可以翻译本页及链接到包含的变更。

Invalidation. If changes are made to the translatable page source, the translation administrator will be given the option to "Do not invalidate translations" for each section. If a section is invalidated, then the translated languages will get a pink background color for those sections, and a clock icon will be shown to translators in the translation interface. If a section is not invalidated, then no changes will be visible to readers of the translated pages, and translators will have to examine the section within the translation interface in order to see the changes.

源语言。还有个含源语言代码的翻译页面,不过这种翻译页面不包含附加标记和其他可译的源页面中使用的翻译相关标记。它不会链接到翻译界面,不过在转置(通常用于可译模板)或导出页面时很方便。 For example, this page is available at Help:Extension:Translate/Page translation administration/en.

Changing the source language. The extension will normally assume that the translatable source page is in the wiki's default language. Administrators can change a specific page's language setting, using the Special:PageLanguage page, so that it can be used as a source page for translation. See Page content language for details.

封闭的翻译请求。一些可译页面的内容只在某段时间中有意义,例如通告和周期性的状态更新(如维基媒体每月亮点)。您可以让这些页面包含翻译,但从翻译界面中隐藏它们。这样不会阻止这些页面之后进行翻译,不过极大降低了用户偶然翻译它们的机会。设置为不建议翻译和恢复可在 Special:PageTranslation 中进行。

优选语言。您还可以指定特别想翻译的目标语言列表,保持语言列表为空表示允许翻译为所有语言。这样的页面让不在优先列表中的语言感到泄气(请参阅前段),翻译为这些语言时,译者会看到提示。您还可以阻止翻译为其他语言,这表示它们在别处使用但在这里您不希望如此。

分组。可以把相关页面分组在一起。这些组与其他信息组类似,它们有自己的统计且包含所有子分组的信息(此时为可译页面)。该功能可用于Special:AggregateGroups。默认在 Special:Translate 的组选择器中 Special:LanguageStats 是收缩显示聚合信息组的。

移动。您可以像其他页面那样移动可译页面。移动时可同时选择移动所有未译子页面。移动时通过后台作业来移动许多相关页面。正在移动时,无法翻译该页面,完成后会记录在翻译日志中。

Warning: Sub-page moving bug: If the translated page that you want to move also has sub-pages that are translated, then you must move the subpages first before moving the parent-page. See the bug for details: phab:T114592.

删除。与移动类似,可在标准位置找到删除功能。您可以通过删除按钮删除整个可译页面或只是其中某种翻译页面。删除操作会同时删除所有相关的翻译单元页。像移动那样,删除也是在后台作业中进行,完成后会记录在页面翻译日志中。该操作需要“delete”和“pagetranslation”权限,不过如果是删除单个翻译单元页则只需标准的“delete”权限。

恢复。类似的,恢复不当编辑也如平常(包括回滚按钮):您只有在编辑有效的翻译单元后,译文页面才会更新。要在译文页面中找到对翻译单元的编辑,请点击编者的“贡献”链接,寻找该时间附近的编辑。

保护。可以在 保护可译页面。无法保护译文页面,也无法保护它们所扩展自的可译页面。要阻止译文的后续编辑,您应该把源语言添加为唯一优先语言并禁用到其他语言的翻译,请参阅上面的优选语言。这两种操作一起可有效阻止对源页面和包含其翻译单元的译文页面。还可以包含单个翻译单元页面,不过不建议这么做。

从译文中移除。还可以取消翻译标记。首先您需要移除页面中所有的 <translate> 标记,然后使用 Special:PageTranslation 或点击可译页面顶部的链接来将其从译文中移除。这样会去除有关页面翻译的结构元素,但原位保留所有现存页面且可自由编辑。不推荐这么做。

可译页面的拆分

翻译可可译页面会生成许多页面,它们一起组成了可译页面:他们的标题由可译页面决定:

  • Page(源页面)
  • Page/<language code>(译文页面,加上没有嵌入部分的源页面)
  • Translations:Page/<translation unit identifier>/<language code>(所有翻译单元页)

此外,还有提取自源页面并保存在数据库中的翻译页面目标和翻译单元。系统会跟踪源页面哪些版本包含翻译标记和哪些版本已标记为翻译。

每次更新翻译单元页时,系统会重新生成相应的译文页面。该操作会产生两次编辑。最近变更中默认隐藏翻译单元页的编辑,不过可在翻译过滤器中选择“显示翻译”让其显示出来。除编辑翻译单元页外的其他操作(如删除和移动)都不会重新生成相应的译文页。

If you need the copy of the source page without markup, e.g. to be pasted in another wiki without Translate,

  • identify the source language code (for English, en) and visit Page/<language code>;
  • click the "查看历史" button to reach an address like this and replace action=history with action=raw in the address bar, press enter:

the text will be displayed or saved.

分割

一般原则:

  1. 所有要翻译的文本必须括在 <translate> 标记内。一个页面可以有许多对翻译标记。
  2. 这些标记外的所有内容在任何译文页面中都保持一致。这些静态文本及标记每个翻译单元替换位置的占位符被称为翻译页面模板。
  3. 太多的嵌入项会使译者很难翻译。请使用更多放置良好的 <translate> 标签来移除嵌入项。
  4. 带有 <translate> 标签的文字会被分割成翻译单元,它们之间会有一或多个空行(两个或更多新行符)。

限制。页面翻译功能给文本附加了一些限制。所有标记都不应跨两个或更多翻译单元。换句话说,每个段落都应该是自包含的。目前软件并不强制如此,但若不符合则页面会渲染错误,这完全取决于 MediaWiki 自身是否能修复最终输出的 HTML。

解析顺序。需注意,在其他标记中的 <translate> 标记会表现异常,因为它们无法穿过解析器。这样通常不会出现问题,不过如果您在尝试新点子则可能会。详细的说,在任何其他标记如 <pre><source> 之前解析它们,<nowiki> 是个例外,在某些情况下(例如渲染页面时)翻译扩展会识别它们,但其他情况则不会(例如生成包含 <translate> 的 Special:PageTranslation 页面中的列表时)。如果您要在源文本中让“<translate>”保持字面含义,您应该使用转义表示,如“&lt;translate>”。

标记放置。如果可行,请把标记放在自己的行中,内容和标记间不用空行。有时无法做到,例如当您要翻译被标记包围的一些内容但不翻译标记时。这样也行,例如:

{{Template|1=<translate>Some localised parameter</translate>}}

要让这样有效,该扩展有个简单的空白处理:保留空白,但如果开放或闭合的 <(/)translate> 标记是一行中唯一的内容则例外。此时忽略在开放标记后或闭合标记前的新行符。也就是说它们不会在渲染后的页面中产生额外的空白。

变量。像模板变量那样使用变量是可行的。其语法为 <tvar|name>contents</>。在翻译时会显示为 $name,而在译文页面会自动被替换为在可译页面定义的值(因此它们是适用于所有译文页面的全局“常量”)。变量可用于隐藏翻译单元中的不可译内容,还可用于经常更新的数字类似的内容。通过在可译页面源和重新标记的页面中改变该数字,可更新所有译文中的这个数字。您无需让译文失效,因为这个数字不是翻译单元页的一部分。

Comma-separated values. For content such as Graph data, that needs to be parsed by the software as comma-separated values, you should separate the translation units between each comma, so that the translating editors don't use localized commas which will confuse the software.

嵌入部分示例

下面列出一些处理这些嵌入的wiki元素的可选方法和建议。

分类 有两种方式添加分类:在译文页面的目标或某个翻译单元中。如果您在译文页面模板中使用分类,则所有的译文会以相同分类结束。如果在翻译单元中使用目标,则您应教会用户命名的结构。另一方面我们显示两种独立于技术方面的可行结构。

通过添加后缀翻译:Category:Cars/fi(推荐使用)

[...]
</translate>

[[Category:MediaWiki{{#translation:}}]]
  • 分类页面不名称不翻译(就像页面名称)。
  • 每个语音都使用一个分类。
  • 页面中的翻译功能可用于翻译分类:分类间比较链接在一起,它们的标题可以翻译(但链接及类似位置中的分类名不行)。

不翻译: Category:Cars

  • 所有译文划归一分类(如果只有少量语言的话很好,但有很多语言时就不是很合适)。
  • 分类名称不要翻译(可以像模板一样原样放置)。
大标题 Headers can in principle be tied to the following paragraph, but it is better to have them separated with an empty line. This way someone can quickly translate the table of contents before going into the contents. When tagging headers, it is important to include the header markup inside the tags and insert a newline between the opening translate tag and the header markup, or MediaWiki will no longer identify them properly. For example, section editing only works with the recommended mark-up given in the example. The markup also immediately gives translators a context: they are translating a header.

错误:

== <translate>文化</translate> ==

错误:

<translate>== 文化 ==</translate>

推荐分割:

<translate>
== 文化 ==

Lorem ipsum dolor.
</translate>
图片 Images that do contain language specific content like text should include the full image syntax in an unit. Other images can only tag the description with optional hint in message documentation of the page after it has been marked.
<translate>
[[File:Europe.png|thumb|right|包括首都城市的欧洲地图]]
</translate>
[[File:Ball.png|50px|<translate>球形图标</translate>]]
链接 Links can be included in the paragraph they are inside. This allows changing the link label, but also changing the link target to a localized version if one exists.

If the target page is (or should be) also translatable, you should link to it by prepending Special:MyLanguage/ to its title. Only the link label will need to be translated, because this automatically redirects users to the translation page in their own interface language, as selected for instance via the UniversalLanguageSelector. However, to achieve a constant behavior the syntax must be used for all links.

Because headers are translated, you cannot rely on the automatically generated id's for headers. You can add your own anchors. To have them outside of the translation template you need to break up the page into multiple <translate> tag pairs around each header you want to have an anchor to.

内部链接:

<translate>
Helsinki is capital of [[Finland (country)|Finland]].
</translate>

链接至翻译页面

<translate>
It has marvelous beaches with a lot of [[Special:MyLanguage/Seagull|seagulls]].
</translate>

外部链接:

<translate>
PHP ([http://php.net website]) is a programming language.
</translate>

页面中的链接:

<span id=culture></span>
<translate>
== 文化 ==

Lorem ipsum dolor.

...

For more about food, see [[#culture|section about culture]].
</translate>
列表 Lists can get long, so might want to split them into multiple parts with for example five items or less in each as follows. Do so only if the items are sufficiently independent to be translate separately in all languages, don't create "lego messages": for instance, you must avoid to split a single sentence in multiple units, or to separate logically dependent parts which may affect each other (with regard to punctuation or style of the list, for instance). To split a list, use <translate>-tags. Do not insert new lines as this will break the HTML output.
<translate>
* General principles
* Headings
* Images
* Tables
* Categories
</translate>
<translate>
* 链接
* 模板
</translate>
数字 With numbers and other non-linguistic elements you may want to pull the actual number out of translation and make it a variable. This has multiple benefits:
  • 你可以更新这些数据为不可翻译。
  • 翻译记忆会忽略这些数据变化。
<translate>
Income this month <code><tvar|income>{{FORMATNUM:3567800}}</></code> EUR
</translate>

Note that this prevents the translators from localising the number by doing currency conversion. The FORMATNUM call makes sure the number is formatted correctly in the target language.

模板 Templates have varying functions and purposes, so the best solution depends on what the template is for. If the template is not a part of longer paragraph, it should be left out, unless it has parameters that need to be translated. If the template has no linguistic content itself, you don't need to do anything for the template itself. For an example of templates translated with page translation, see Template:Extension-Translate. To use this template, you need to have another template similar to {{Translatable navigation template}}, because you cannot include the template by {{TemplateName}} anymore. This is not yet provided by the Translate extension itself, but that is in the plans.

Another way is to use the unstructured element translation to translate the template, but then the language of the template will follow the user's interface language, not the language of the page they are viewing.

更改源文本

一般原则:

  • 避免更改
  • 变动尽可能的独立
  • 不要人为添加翻译单元标记

Unit markers. When page is marked for translation, the system will update the translatable page source and add unique identifiers for each translation unit. 参见下面的例子。 These markers are crucial for the system, which uses them to track changes to each translation unit. You should never add unit markers yourself. The markers are always on the line before the unit; or, if it starts with a header, after the first header on the same line. The different placement for headers is needed to keep section editing working as expected.

<translate>
== Birds == <!--T:1-->
Birds are animals which....

<!--T:2-->
Birds can fly and...
</translate>

Changing unit text. Changing is the most common operation for translation units. You can fix spelling mistakes, correct grammar or do other changes to the unit. When re-marking the page for translation, you will see the difference in the unit text. The same difference is also shown to translators when they update their translations. For simple spelling fixes and other cases where you don't want the existing translations to be highlighted on the translated pages, you can avoid invalidating them: translators will still see the difference if they ever update the translation for any reason.

Adding new text. You can freely add new text inside <translate> tags. Make sure that there is one empty line between adjacent units, so that the system will see it as a new unit. You can also add <translate> tags around the new text, if it is not inside existing <translate> tags. Again, do not add unit markers yourself, the system will do it.

删除文本。 你可以删除整个翻译单元,但请同时删除翻译单元标记。

Splitting units. You can split existing units by adding an empty line in the middle of a unit, or by placing <translate> tags so that they split the unit. You can either keep the unit marker with the first unit or remove it altogether. In the first case, translators see the old text when updating the old translation. If you removed the unit marker, both units will behave as if no translation ever existed, after the page is re-marked for translation.

原始状态 保持标记 移除标记
<!--T:1-->
Cat purrs. Dog barks.
<!--T:1-->
Cat purrs.

<!--T:2--> (重新标记后添加的)
Dog barks.
<!--T:2--> (重新标记后添加的)
Cat purrs.

<!--T:3--> (重新标记后添加的)
Dog barks.
Kissa kehrää. Koira haukkuu. Kissa kehrää. Koira haukkuu.

Dog barks.

Cat purrs.

Dog barks.

移动翻译单元 如果你要移动翻译单元,你可以移除所有内容但至少应移除一个翻译标记。

Moving units. You can move units around without invalidating translations: just move the unit marker together with the rest of the unit.

Before marking the new version of the page for translation, ensure that the best practices are followed, especially that translators get a new translation unit if the content has changed. Also make sure that there are no unnecessary changes to prevent wasting translators time. If the source page is getting many changes, it may be worthwhile to wait for it to stabilize, and push the work for translators only after that.

Unused unit translations are not deleted automatically, but that should not cause trouble.

移动翻译页面

If you have been translating pages before using the page translation system, you might want to migrate the pages to the new system, at least the ones you expect to have new translations and want statistics for. You will probably have existing templates for language switching and maybe different page naming conventions.

You can start migration by cleaning up, tagging and marking the source page. You can keep the existing language-switching templates while you migrate the old translations. If your pages follow the language code subpages naming convention, they will be replaced with the source text after marking the source page for translation, but you'll still be able to access translations from history.

This manual task has been partly automated by Special:PageMigration, which shows the source and target units besides each other and allows the user to adjust the units by providing a set of features mentioned later in this page.

如何使用?

Screenshot showing an example use of Special:PageMigration for "Help:Special pages" as page name and "fr" as language code.
  1. 前往Special:PageMigration
  2. Enter the title of the page and the language code. For example, "Help:Special pages" & "fr"
  3. The source text which was divided into units by Translate and the imported translations will be shown besides each other with some initial alignment.
  4. Use the actions available for each unit to manually do the remaining alignment
  5. As translated units are editable, do required manual improvements (for add translation variables, fix links and markup, etc.)
  6. Click on the "保存" button. This will create pages under the Translations namespace of the form Translations:Page/<translation unit identifier>/<language code>. The old translations have been imported into Translate.
  7. Else, if you wish to abort the importing, click on the 'Cancel' button.

可用操作

Each row consisting of source and target unit has a set of action icons. They are used as follows:

  1. Add: Clicking on this action icon adds a new empty unit below the current one. Use this feature if you want to split the current unit and need a unit below.
  2. Swap: Clicking on this action icon swaps the content of the current unit with the unit below it. You can use this feature when the units get aligned improperly due to different ordering of sections. Or when you need to drag a unit below or above. In either case, remember it swaps with the unit below and does not create any additional units.
  3. Delete: Clicking on this action icon completely removes the corresponding target unit from the page and shifts the remaining target units up by one unit. Use this to remove unwanted content like code or imported translations which are present completely in the source language. Note: this irrevocable action (in the current session).

故障排除

  1. If you mark a page for translation and immediately go to the special page and try to import translations, you may get an error message like "<page-name>/<language-code>没有旧翻译". This is because FuzzyBot didn't fuzzy the messages on the old page yet: the tool won't find an edit by FuzzyBot on the translation page. In this case, simply wait for FuzzyBot to do its job. Once an edit is seen, you can proceed with the imports.
  2. Please wait for some time after pressing the "保存" button. While the button background remains gray, there is an ongoing process of importing non-empty units. Once the button becomes colored again, the import is completed.

小贴士

  1. Migration will be easier if you first (before the mark to translation) check whether existing translations are similar to the original English text, and manually edit the structure of pages: break paragraphs and lists, add the missing headers (even if empty).
  2. Will be useful to check the result in the core translation interface - some of the units may be immediately marked as obsolete because of errors markup or if not all of the translation variables was added.
  3. Translation of the page title will have to be added manually. If you do not know very well the language of the imported page, you can try to find the translation of the page title among the "links here" or sometimes in redirects. Note: Please don't translate the namespace, keep it untranslated.