Help:Extension:Translate/Insertables

W

Translatable strings often contain markup that should be retained as-is in the translation.

Typing that markup can be slow and difficult because special characters are common.

Insertable is a piece of markup that is presented to the translator as a button or other interface element.

Clicking the button inserts the piece of markup into the translation to the current cursor position.

Each message group can have one  .

This class is responsible for generating a list of s.

Each  has three parts:


 * 1) What to display to the user


 * 1) What is inserted before cursor position in the translation


 * 1) What is inserted after cursor position in the translation

Translate extension comes with   built-in.

Suggesters for other type of content can be found in the [https://phabricator.wikimedia.org/diffusion/GTWN/browse/groups translatewiki.net git repository].

Code example
Here is an example about adding insertables support for existing file based message group: FreeCol.

The YAML file has been help>Special:MyLanguage/Help:Extension:Translate/Group configuration example|trimmed for brevity.

The newly added lines are highlighted.

FreeCol.yaml:

Suggester.php:

The parameters to Insertable are: