Help:Extension:Translate/Group configuration

There are many ways of adding message groups to Translate extension. The intention is to migrate everything to new format based on YAML formatted files. About half of the premade groups are already using YAML configuration.

Standard group configuration format
It is very easy to add message groups using the new standard format. All that needs to be done is to define a namespace and add a file into ; see configuration page for more details. Example:

The files itself use the YAML syntax. The syntax itself is not described here, but it is easy to learn and all the premade groups can be used as examples. Remember to use spaces instead of tabs for indentation. Each file can define multiple message groups. Each group definition is separated by line with three dashes, which is the standard document separator in YAML.

Definitions are broken into few top-level items: BASIC, FILES, MANGLER, CHECKER, TAGS, AUTOLOAD and special TEMPLATE. Some custom groups may add more top-level items. Not all groups need to define all of them.

BASIC
This section contains basic information about the group, like unique id and name. List of possible keys (mandatory keys are marked with *):

Example: BASIC: id: out-freecol label: FreeCol (open source game) description: "" namespace: NS_FREECOL display: out/freecol/ class: FileBasedMessageGroup

FILES
This section describes the filesystem layout and format of message files for groups of type FileBasedMessageGroup. List of possible keys (mandatory keys are marked with *):

The path variables are:

Example: FILES: class: JavaFFS sourcePattern: %GROUPROOT%/commonist/messages_%CODE%.properties targetPattern: commonist/messages_%CODE%.properties

MANGLER
Mangler is a way to mungle message keys to avoid conflicting message keys in multiple groups:

Example: MANGLER: class: StringMatcher patterns: - "*"

CHECKER
Checkers run checks on the translated messages. If they find problems, those translations are highlighted for translators.

Example: CHECKER: class: ShapadoMessageChecker checks: - ShapadoVariablesCheck

TAGS
It is possible to assign tags to messages. Each tag takes list of message keys (after mangling). "*" can be used as wildcard. The following tags are supported:

Example: TAGS: optional: - lang_locale - lang_dir ignored: - charset

AUTOLOAD
This item takes list of class names with filenames as values. This way custom classes can be bundled easily with your custom message groups. The path should be relative to the location of the group configuration file itself. Example: AUTOLOAD: ShapadoMessageChecker: Checker.php

TEMPLATE
There is handy shortcut if you are defining multiple similar message groups. To avoid repetition, have the first definition start with this key. You can use any other top-level keys as subkeys for this item. All other groups will use these definitions as default values. Each group can of course override the default value from the template.

Example: TEMPLATE: BASIC: namespace: NS_SHAPADO class: FileBasedMessageGroup description: ""

FILES: class: YamlFFS codeAsRoot: 1 codeMap: be-tarask: be-TARASK

GROUPS (for AggregateMessageGroup class)
This key only takes list of group ids this message group consists of. Example: GROUPS: - out-shapado-ads - out-shapado-announcements - out-shapado-answers - out-shapado-badges