Plugin source location: <serge_root>/lib/Serge/Engine/Plugin/limit_languages.pm
Plugin always attaches itself to the following callback phases:
after_load_source_file_for_processing
is_file_orphaned
can_process_source_file
can_process_ts_file
can_generate_ts_file
can_generate_localized_file
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.
By default, the plugin provides the following behavior:
job → destination_languages
parameter.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.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:
When default rules are not enough, you can implement your own ones, by defining one or more if { ... }
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: