Jump to content

新闻组/翻译

From Meta, a Wikimedia project coordination wiki
This page is a translated version of the page Newsletters/Translation and the translation is 11% complete.

Newsletters是维基人员了解他们感兴趣的特定主题的一种方式。提供除英语之外的其他语言的新闻通讯扩大了您的潜在受众,因为许多维基人员不懂英语。其他人可以阅读英语,但仍然喜欢用他们的母语阅读新闻。

截至2014年,有一些工具可以让您更轻松地准备和提供多语种新闻通讯:

  • 翻译扩展用于结构化翻译您的简报内容;
  • 汇编多语言消息Lua模块将页面的所有翻译组合成要通过wiki发送的文本;
  • MassMessage工具,用于在维基媒体wiki上轻松将全局信息传递给选定的页面(或订阅者)。

本页描述的大多数流程、工具和提示都是由技术新闻团队构建和收集的。您可以阅读他们的博客文章了解有关如何准备技术通讯的更多详细信息。每周翻译并以多种语言提供。

If you encounter difficulties setting up your multilingual newsletter, you can ask Guillaume for assistance.

Preparing and delivering multilingual newsletter: How it works

In short, this is how the process goes:

  • When your content is stable, tag it and mark it for translation, and reach out to Wikimedia translators to ask for their help.
  • When your translations are ready, use the Lua script to combine all your translations into a composite text.
  • Use the MassMessage tool to send that composite text to your subscribers. If a translation is available for a wiki's content language, the text will be posted in that language. Otherwise, it will be posted in the default language (English).

This page focuses on assembling and delivering the newsletter and its translations. For more information about page translation and the Translate extension, see:

Initial setup

There are a few things you need to do the first time you want to send a multilingual newsletter. You'll only have to do this once.

Import the Lua script on your source wiki

Many newsletters are prepared on Meta and can use Module:Assemble multilingual message directly.

If your newsletter and its translations are living on another wiki, you need to import Module:Assemble multilingual message into that wiki. It's best to use transwiki import from Meta to preserve attribution and the history.

Create a sandbox page

The sandbox page is where you'll use the Lua script to automatically assemble the translations. For example, Tech/News/Sandbox is where the multilingual version of Tech News is assembled. For the moment, simply create a page for your newsletter with boilerplate text (please avoid main namespace).

Regular process

The process that follows is the one you'll go through every time you send an issue of your newsletter. The process is very detailed to make it easier to get started; once you've done it a couple of times, you probably won't need it any more.

Mark the content of your newsletter

You probably have content on your page that you don't want to include in the newsletter you send. This typically includes headers, navigation templates and categories.

The Lua script uses Labeled section transclusion to identify the actual content you want to send. Choose a marker like my-nifty-newsletter and tag your content outside of the <translate></translate> tags like so:

<section begin="my-nifty-newsletter"/><translate>The content of your newsletter starts here.
...
The content of your newsletter continues here.
...
The content of your newsletter ends here.</translate><section end="my-nifty-newsletter"/>

This is something you need to add to each issue of your newsletter, but once you've added it once it's a simple matter of copy-paste to add it to the next one.

Generate the multilingual message

The Lua script pulls all translations together to assemble the multilingual newsletter, ready for delivery.

At this point, you should have:

  • the Lua script
  • the sandbox page
  • the translatable newsletter you want to distribute; in the example below, we'll call it "My nifty newsletter/2014/August"

The process goes like this:

  1. Go to your sandbox page, and open the edit window.
  2. Add the following code:
    {{#invoke:Assemble multilingual message|assembleMessage|marker=|page=|}}.
    • marker= is where you add the marker you used above to tag your content;
    • page= is where you add the translatable page you want to send;
  3. After the page, add the list of language codes of the languages in which your page has been translated. For instance, add |es|fr|uk if your page has been translated to Spanish, French and Ukrainian. Do not add "en" for the English version: as the default language, it is automatically included.
  4. Your code should now be something like:
    {{#invoke:Assemble multilingual message|assembleMessage|marker=my-nifty-newsletter|page=My nifty newsletter/2014/August|es|fr|uk}}.
  5. Save your edit.

Voilà! This one line of code should now have generated a whole bunch of wikitext, that consists of a giant #switch parser function containing all the translations.

Send the multilingual message with MassMessage

The multilingual newsletter is delivered to subscribers across wikis by MassMessage; if a translation is available for the wiki's language, that translation is posted.

The Lua script does all the hard work: it goes through all the translations you give it, and assembles them together to generate a ready-to-send message:

  1. On the sandbox page, copy the whole content generated by the script;
  2. Open Special:MassMessage and paste the copied content into the field labeled "Body of the message"
  3. Scroll to the bottom, and add links to your userpage/usertalkpage before the timestamp (~~~~~). (A 3-tilde or 4-tilde signature would just be signed by "MediaWiki message delivery".)
  4. Fill out the other fields as you would do for a monolingual newsletter (see help about mass messages)

Known limitations

Lua script

  • You can't use tables for your newsletter's layout. Tables mess up the {{#switch used to select the appropriate language when the newsletter is posted. As a general rule, you should avoid tables and other complex formatting for newsletters, as they're easier to get wrong (see the general tips for newsletter authors).

Errors in one translation will break the assembled message when sent

  • If one of the translations has a markup error, such as an un-closed [[wikilink, it will break the assembled newsletter by showing all languages at once when you send it (to your test distribution list). To find the broken translation, add each language one at the time in the Assemble module.

See also