Jump to content

Content translation/Specification

From mediawiki.org

Prototype

The prototype which acts as design reference too is present at: http://pauginer.github.io/prototype-translate/content-translation.html

Architecture

See architecture documentation

Widgets

The CX [1] UI consists of 4 component widgets - The header, source article widget, translation widget, translation tools widget.

Communication between Widgets

We separate the responsibilities and follow an event driven approach. Imagine it as a global single event dispatcher. Widgets subscribe to events, widgets publish events (fire), widgets can attach and detach from the event registers.

Suppose you click on a word in source article. We wont call any methods of other widgets. We will pretend that the source article widget does not know about other widgets. On click of a word, the widget will raise/publish an event say mw.ex.source.word.select. Now, multiple consumers can subscribe to this event. One would be the translation column. Other will be the tools widget-inside tools we are going to have a lot of translation helpers.

For event subscribe/publish pattern, we use mw.hook, which is a wrapper on top of $.Callbacks.

UI styling

LESS is used for the extension.

Naming conventions

  • All CSS class names should have a prefix cx[1].
  • All RL modules have a prefix ext.cx
  • The jquery object namespace is mw.cx
  • CSS classes follow BEM naming conventions
  • Follows MW coding, naming conventions
  • As of late 2016, transition to OOJS is in progress

Workflow

  • Starting: From an entry point ("gray interlanguage link"), through a direct link, or through the dashboard
  • Loading the source article and the translation side by side.
    • Initial load: The source column must show a loading indicator. The translation column must have no content. The "+ Add translation" placeholder must be shown in the first section, or in other sections on hover.
    • During translation, each section is auto-saved to a central parallel corpora database.
    • Loading a saved translation: The source and the target column must show loading indicators. The translated text must be loaded with the same content as it had when it was auto-saved.
  • Clicking an empty section pre-fills the translation.
    • If the user selected "no automatic translation", it must remain empty.
    • If the user selected "source text", the source text must be pre-filled with link, reference and template adaptation.
    • If the user selected an MT engine, the machine-translated text must be pre-filled with link, reference and template adaptation.
  • Links
    • Link are adapted automatically when using automatic translation.
    • If text is selected in the target column that can be linked to an existing article in the target wiki, the link card must be shown that allows to link to it.
    • It must be possible to add a link to a non-existing ("red") target article.
    • Clicking a link in the source column must show a link card with the source article (with title and image if available). If a directly corresponding target article exists, it must be shown, too. If not, the user must have the possibility to link to a different article.
  • References
    • Clicking a reference must show reference adaptation card
  • Math
    • ‎<math> formulas are copied as-is.
  • Templates
    • A template can be skipped, copied as source (possibly dysfunctional in the target language), or adapted in detail if an equivalent template exists
    • Equivalent template adaptation is described in Templates
  • Categories
    • Directly corresponding categories are adapted automatically.
  • Publishing
    • The article is published as a full-fledged wiki page.
    • Interlanguage links are added using Wikidata sitelinks.

URL structure

Content Translation mainly works on the special page Special:ContentTranslation. The URL parameters are:

  • page — source title
  • targettitle — target title
  • from — source language
  • to — target language
  • campaign — campaign name, mainly for logging purposes

Testing

(To be redefined in January 2017.)

Bug reports

Please report bugs to Phabricator using the "MediaWiki-extensions-ContentTranslation" project. Don't worry about specifying version, severity, hardware, or OS if you don't know.

References

  1. 1.0 1.1 ContentTranslation is abbreviated everywhere as cx