Documentation section

Excluding String Keys

Learn how to include/exclude string keys during upload and format conversion.

There are two reasons for filtering strings:

  • for upload, to filter out sensitive strings and strings that you don’t want to translate
  • for format conversions, to filter out strings that you don’t want to be included in the converted file; e.q., you may want to remove platform-specific texts

Filtering keys 🔗

Strings are always filtered based on rules for their keys.

You can define filtering rules using keySeparator, includeKeys and excludeKeys. For upload, define it directly in the upload section. For format conversions, define it separately for each of actions.

Filtering example:

{
  "keySeparator": ".",
  "includeKeys": ["REGEX:key_.*", "MATCH:my_key"],
  "excludeKeys": ["REGEX:private_.*"]    
}

Structured keys and keySeparator 🔗

To match structured keys like in the example below, you can define keySeparator. The default value is ., but you can change it to any string.

{
	"level1": {
		"level2": {
			"key": "Text"
		}
	}
}

For example, with "keySeparator": "->" the structured key from file above would be encoded as: level1->level2->key.

Filtering rules 🔗

Both includeKeys and excludeKeys is a list of strings; list of filtering rules. The format of each of the rules is OPERATION:parameter.

Available operations:

Operation Description
MATCH:value The rule is valid only if the key exactly matches value.
MATCH-CI:value The same as MATCH:value but this is case-insensitive variant.
CONTAIN:value The rule is valid only if the key contains value.
CONTAIN-CI:value The same as CONTAIN:value but this is case-insensitive variant.
PREFIX:value The rule is valid only if the key starts with value.
PREFIX-CI:value The same as PREFIX:value but this is case-insensitive variant.
SUFFIX:value The rule is valid only if the key ends with value.
SUFFIX-CI:value The same as SUFFIX:value but this is case-insensitive variant.
REGEX:expression The rule is valid if the key matches the regular expression defined by expression.

Invalid rules are skipped.

Filtering priority 🔗

If includeKeys is empty or missing, all texts except for those excluded by excludeKeys are processed.

If includeKeys is not empty, only explicitly included texts are processed.

Rules in excludeKeys have higher priority than those in includeKeys. It means that if the same text matches a rule both in includeKeys and excludeKeys, it is not processed.

Format specific keys 🔗

For some formats, such as XLIFF, INI, etc., the key may carry also additional information about internal file structure.

Be sure to use the correct expression for filtering - e.q., CONTAIN filter instead of the exact match.

Also, consult the list of phrases in Localazy for the key overview.