|
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 2023\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 new line will be added below the currently selected INDEX line. In the example below, Row 4 was selected before pressing the Add button.
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 cause different fields to become greyed out as they are unnecessary.
The order in which the keywords are listed in a Settings file can have an influence. Because rules cannot include or append to text which is already locked as a keyword. It is thus advisable to apply the rules locking longer text or phrases before shorter ones.
Only the rules which are ticked as Enabled will be applied when Applying Locks and Keywords.
Rules can also be restricted to apply to only certain file types in your project in the FILE TYPES column. By default, it is always set to All file types.
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.
You may also Import rules from another Settings file (.xml). This can be useful in consolidating rules from different Settings files.
Your list of rules is indexed in a specific order in which they will be applied. This is important because applying Keywords will not overwrite or extend an existing keyword, it only applies if the regular expression in the settings file is fully met. Should a portion of the expected keyword be already a keyword, the new keyword will not apply.
|
Although your list may have LOCK rules amongst or after KEYWORD and TAG rules, they will always be applied first. This because they lock the entire segment in which case there is no need to apply individual keywords. |
The rules total and selected count is automatically updated and displayed above the list to quickly assess when it is longer than the window.
Reordering the rules is made easy either using the and
buttons, or dragging and dropping. When using the arrows buttons, it is possible to select multiple rows and move them together.
To delete rules, select one or more row (use CTRL or Shift + mouse click) and press the button. You will be prompted to confirm you want to delete the rules, after which point you cannot reinstate the deleted rules.
The Search Keywords... tool located at the top right of the Settings dialog offers the ability to search within the various columns of the Locks & Keywords. The entered text instantly highlights the matching text and filters out any non-matching rows, for example:
Press the button to clear the search.
The list of Locks & Keywords can be sorted by any columns. The default is the INDEX column.
Below, the sorting has been set on the EXPRESSION/TAG NAME column. As a result, the INDEX numbers are now in a different order and highlighted in Red.
At this point, pressing the Reorder Keywords File by Current Sorting Order button will rewrite the Settings file in the current sorted order and reassign the INDEX values in a sequential order (1, 2, 3, ...).
This update to the .xml file will only occur if you press the Save button, Save as or click OK on the dialog. Pressing Cancel will discard the current changes..
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.ie, 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" |
https://.* |
Defines a segment with regular expression that begins with https:// the . means any character the * means any number of times |
|
will lock segment"https://www.alchemysoftware.com" |
|
will not lock segment"Click on the website https://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.ie, 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 |