Limit Destination Languages on a Per-File Basis

Plugin source location: <serge_root>/lib/Serge/Engine/Plugin/

Plugin always attaches itself to the following callback phases:

This plugin allows to map each file to a subset of languages it needs to be localized into. So, in addition to job-wide list of target languages, one can override the list of languages for any specific file, based on rules that examine the file name or its contents.

Default Behavior

By default, the plugin provides the following behavior:

  1. By default, each file is localized into all languages specified in the job → destination_languages parameter.
  2. When L10N_LIMIT_DESTINATION_LANGUAGES=aa,bb-cc,dd,... string appears in the file, the list of languages ('aa', 'bb-cc', 'dd', ...) is used as a list of languages localization should be limited to.
  3. When L10N_EXCLUDE_DESTINATION_LANGUAGES=ee,ff-gg,... string appears in the file, the list of languages ('ee', 'ff-gg', ...) is removed from the original list defined in a job.

These rules are equivalent to the following plugin configuration:

Default Rules

Custom Rules

When default rules are not enough, you can implement your own ones, by defining one or more if { ... } rules inside plugin's data config section. The if rules are processed top to bottom; each rule can add or remove languages so the most priority rules are placed at the bottom. See the example below: