Page MenuHomePhabricator

Allow previewing translations
Open, LowPublicFeature

Description

A button to show preview of message (translation)

It will be easy to find syntax errors in the translation, or see how the translation will look like. It could reduce the number of cases such as T379558

Event Timeline

Nikerabbit subscribed.

Messages come from various different places and we don't actually know which of them are parsed as wikitext.

Maybe we should? When not using the translation interface, non-wikitext messages are currently presented as wikitext, that could be also fixed based on this piece of information. I think it could be stored at the group (sometimes aggregate group) level, with possible values:

  • Let MediaWiki decide. This is what currently happens: wikitext by default, but the extension in the message name can override this (JSON, CSS etc.). MediaWiki core, extensions, skins and Wikimedia overrides should use this. Translate doesn’t have to do anything special about them.
  • Unknown. This is what most non-MediaWiki groups (OpenStreetMap, Wikipedia apps, Toolforge tools etc.) should use, at least initially. These pages should have a content model of CONTENT_MODEL_TEXT: MediaWiki will present them in a <pre> without trying to interpret them at all.
  • Leave this configuration open for other well-known types (Markdown, Android etc.). Implementing these types will include writing a new content type and content handler for them.

The preview makes sense for any type other than unknown (since the <pre> doesn’t add anything to the <textbox> the user is typing into).


@Nemoralis, please note that even if this feature is implemented, it won’t be able to provide more than what clicking Show in wiki editor and then previewing there could provide: it won’t be able to provide sample parameters, it won’t be able to tell if the message is actually parsed at the start of a line (so # et al really cause problems), whether all wikitext is usable in the message, and so on. In order to provide such information, we’d have to expect developers writing translatable code to provide all sorts of metadata, which isn’t realistic.

Nikerabbit moved this task from Backlog to tux on the MediaWiki-extensions-Translate board.
stjn subscribed.

This is a problem especially with editing message documentation, since the link from

image.png (230×742 px, 22 KB)
leads to Special:Translate and not to a normal editing page but you can’t actually preview anything on that page.

Syntax highlighting can also help to find & fix syntax errors, I fixed this using wiki editor