(source) C. Scott Ananian: Ideas/A Dozen Visions for Wikitext/Annotations

Annotations

Let's consider how we annotate content for translation on a multilingual wiki. This example is taken from mw:Help:Extension:Translate/Page_translation_example. We start with some article content:

Fréttinga is a small municipality in MungoLand, located on the BaMungo island.
It hosts a population of about 400 people. It has some agriculture and fishing.
Tourists like to visit it in the summer time.

== Services ==

It doesn't have many services. There is a shop, and a car ferry visits the island
from the mainland once a day.

The first step is to mark the annotated regions, which we do with explicit markup in the wikitext.

Article prepared for translation
<translate>

<!--T:1-->
Fréttinga is a small municipality in MungoLand, located on the BaMungo island.
It hosts a population of about 400 people. It has some agriculture and fishing.
Tourists like to visit it in the summer time.

== Services == <!--T:2--->
<!--T:3-->
It doesn't have many services. There is a shop, and a car ferry visits the island
from the mainland once a day.

</translate>

The translation UI then shows the translation regions:

Translation regions

The translator can then translate each of them:

Reviewing translations

Of course, this is Wikipedia, so the original article will quickly get changed.

Changed source article
<translate>

<!--T:1-->
Fréttinga is a small municipality in MungoLand, located on the BaMungo island.
It hosts a population of about 400 people. It has some agriculture and fishing.
Tourists like to visit it in the summer time.
It has marvelous beaches with a lot of seagulls.

== Services == <!--T:2--->
<!--T:3-->
It doesn't have many services. There is a shop, and a car ferry visits the island
from the mainland once a day.

In 2009 January the roof of the church in the island fell down. It was rebuilt
collaboratively the following summer.

</translate>

The translator can update the translation units, as well as indicate whether the change was just a copy-edit (in which case the translation doesn’t need update) or needs further attention.  This notifies translators, who can then update the translations.

Marking changes

But let’s look again at our wikitext.  Even though we’re not encoding /all/ of the knowledge here in the wikitext – we’re storing the actual translations of these texts somewhere else – there’s still a lot of strange stuff cluttering up our article, which is often off-putting to editors.

Cluttered markup
<translate>

<!--T:1-->
Fréttinga is a small municipality in MungoLand, located on the BaMungo island.
It hosts a population of about 400 people. It has some agriculture and fishing.
Tourists like to visit it in the summer time.
It has marvelous beaches with a lot of seagulls.

== Services == <!--T:2--->
<!--T:3-->
It doesn't have many services. There is a shop, and a car ferry visits the island
from the mainland once a day.

<!--T:4-->
In 2009 January the roof of the church in the island fell down. It was rebuilt
collaboratively the following summer.

</translate>

This example isn’t unusual.  There are a lot of examples on our projects with information which is cumbersome to include inline in the wikitext:

In addition there's other information the community would like to include with an article but are currently blocked on because the extra inline information would be too disruptive to “ordinary” editors:

There's a large list of use cases collected from the community at the Annotations session of the Wikimedia Developer Summit in 2017.

Variable-length/structured arguments

We are proposing a general annotation service to allow us to record all the information which doesn’t belong in wikitext.  Here are the important properties of annotated content on our projects:

Annotations should be transparent: the presence of annotated content should never prevent editors from being able to easily update the base content. There are many authors, many annotations, and many annotators.

What does editing annotated content look like?  At the top of this section we showed one example with the Translate extension, which used a separate editor for the annotated content (translations). But we can also look at the InlineComments extension for an idea of a more generic interface. Viewing and refining the annotation regions is done with a special mode in Visual Editor:

Marking an annotation region

Annotations are anchored to a specific revision, and they can be specified as a range in either the wikitext source or in the HTML DOM; Parsoid allows mapping back and forth between these.

Just as we’re using VisualEditor to mark regions, I expect it will probably be useful to make a generic-but-extensible mechanism to edit annotation content alongside the source text.  This is a simple example from InlineComments:

Adding an annotation

Not every annotation type will use this simple form in the sidebar – the Translate extension uses a custom editor as we saw earlier – but providing a generic functionality of this sort will probably make it easier to develop new annotation types and provide some common user interface elements to make editing new annotation types easier to learn.

Next section: Visual Templates

C. Scott Ananian [[User:cscott]]