Customizing Locks and Keywords settings |
Create rules using regular expressions to apply Locks Keywords to your projects, preventing full segments, words or phrases within a segment and tags from being translated. Furthermore, the rules can be customized to only apply to specific file types.
Users may have as many Keyword Settings files as they wish. The default Settings File is C:\Users\Public\Alchemy Software\Catalyst 2021\keywords.xml (see preview below). To edit or create a new Settings File, go to EXPERTS > Locks & Keywords > Options...
In the Locks and Keywords settings dialog, click the Add button to add a new rule to your new or existing Settings File.
The first choice to make is to select the appropriate type of rule for which to enter a regular expression, double click to open the dropdown:
Each of the 3 options above will have different fields greyed out as they are not necessary.
The order in which the keywords are listed in a settings file can have an influence. Rules cannot include or append to text which is already locked as a keyword so it is usually advisable to apply the rules locking longer text or phrases before shorter ones. In this settings dialog, you can move a rule up or down the list using the Up arrow and Down arrow buttons.
Only the rules which are ticked as Enabled will be applied when Applying Locks and Keywords.
Rules from previous Catalyst version in .txt format can be imported with the Import... button. If a rule already exists it will not be duplicated.
KEYWORD uses regular expressions entered in the Expression field to select text to lock within a segment, known as keywords.
The Match Whole Word option, available to the KEYWORD type only, is set to True by default. While True, the expression will lock the keyword only if it matches whole words, i.e. surrounded by words delimiters such as spaces.
Example: See the results of using either Match Whole Word options when the expression "Copy" is applied to the segment "Copyright".
Expression |
Match Whole Word |
Results |
Copy |
True |
Copyright No keyword applied because Copy is not a whole word. |
Copy |
False |
Copyright
Portion of the word Copyright is a keyword. |
Sample Keywords from the default keywords.xml Settings File |
In the example above a single keyword in defined on each line using a regular expression.
Expression |
Description |
ALCHEMY |
Defines a keyword "ALCHEMY", all uppercase only if found as a whole word. |
[0-9]+ |
Defines a keyword containing one or more digits. This is a powerful and easy way to lock all numerical data in a project and to exclude these from word count analysis reports. |
https*://[a-zA-Z0-9]+\.[a-zA-Z0-9]+\.[a-zA-Z0-9]+ |
This keyword matches web addresses such as https://www.alchemysoftware.com, or https://123.alchemysoftware.com |
<$[^>]+> |
This keyword matches variables in FrameMaker files such as <$pagenum>. Match Whole Word is set to False ensuring the keyword is applied even if the text is found without spaces around it. |
Using LOCK applies a lock to the segment matching the defined criteria, preventing its translation.
Lock segments in two ways:
Matching text or syntax.
Use the Expression field to enter a regular expression.
When defining segments to lock by content, the expression must match the entire segment.
Matching the segment ID.
Use the ID field to enter the segment ID.
When defining segments to lock by ID, the ID is case sensitive and must match the whole id.
Sample Locking Entries from the default keywords.xml Settings File |
In the example above a locking entry is defined on each line
Expression |
Description |
Copyright Alchemy Software |
Locks any segment matching exact text "Copyright Alchemy Software" |
|
will lock segment "Copyright Alchemy Software" |
|
will not lock segment "Copyright Alchemy Software 2020" |
.*[a-z][0-9].* |
Defines a segment containing a lower case letter followed by a digit, e.g. "SpinControl1" or "User Control2" .* means any character, zero or more times [a-z][0-9] means any character in range 'a' to 'z' followed by a number in range '0' to '9' .* means any character, zero or more times |
|
will lock segment "Contains User Control1" |
|
will not lock segment "Contains User CONTROL1" |
http://.* |
Defines a segment with regular expression that begins with http:// the . means any character the * means any number of times |
|
will lock segment"http://www.alchemysoftware.com" |
|
will not lock segment"Click on the website http://www.alchemysoftware.com" |
https*://[a-zA-Z0-9]+\.[a-zA-Z0-9]+\.[a-zA-Z0-9]+ |
This keyword matches web addresses such as https://www.alchemysoftware.com, or https://123.alchemysoftware.com |
ID |
Description |
1001 |
Entering text in the ID field signifies this is an ID match. Any segment with an ID 1001 will be locked |
|
will lock segment String ID 1001: "Click here to continue" |
|
will not lock segment String ID 21001: "Click here to continue" |
title |
Any segment with an ID equal to "title" will be locked. As with Expressions it is case sensitive. |
|
will lock segment String ID title: "Click here to continue" |
will not lock segment String ID Title: "Click here to continue" |
Select TAG in the type dropdown to define words or phrases to be protected when found between specific inline tags.
Enter the tag element name which encapsulates the text to keyword in the Expression field.
Enter an attribute name found in the tags encapsulating the text to keyword in the Attribute Name field.
Enter an attribute value found in the tags encapsulating the text to keyword in the Attribute Value field.
The strings added in Expression, Attribute Name and Attribute Value fields are treated as standard text. Meaning they do not use regular expression and are not case sensitive.
The TAG keyword type will lock keywords when matching all of the defined 3 tag parameters. See examples below. |
Using this segment as an example:
This TAG keyword matches the text " or CATALYST Developer/Pro" if found in the tag MadCap:conditionalText AND its attribute is MadCap:conditions AND the attribute value is Status.UnderConstruction Expression = MadCap:conditionalText |
This TAG keyword matches the text " or CATALYST Developer/Pro" if found in the tag MadCap:conditionalText Expression = MadCap:conditionalText |
This TAG keyword matches the text " or CATALYST Developer/Pro" if found in ANY tag with attribute name MadCap:conditions AND the attribute value is Status.UnderConstruction Attribute Name = MadCap:conditions |
This TAG keyword matches the text " or CATALYST Developer/Pro" if found in the tag MadCap:conditionalText AND includes attribute name MadCap:conditions Expression = MadCap:conditionalText |