|
Defining XML Rules |
When an XML document is inserted into Alchemy CATALYST, both the markup and content are processed, however unless an element/attribute is selected to be localized, it will not be displayed in the workspace. By default, Alchemy CATALYST assumes nothing is to be translated in an XML document unless a rule defines the elements/attributes to be translated. You thus need to create a parsing rule.
Follow these instructions to specify elements and attributes for translation, to create a parsing rule:
Go to HOME > File types & Parsing Rules.
Click on XML Based Files in the Configurable Rules File Group list. Then select the .xml file extension.
Several rules are available by default.
Select a rule name to edit with the Edit Methods... button or create a new rule clicking the Add... button.
CATALYST enables you to append to an existing rule which was created for a different XML template. A template is an XML file from which all the elements and attributes have been listed in the editor to create a rule. Thus using another template you are listing elements and attributes which were not already present in the previous template, appended to the bottom of the list with a green background. That way you can extend the methods to suit multiple localizable XML files with one rule.
|
Alternatively, go straight to the Edit Methods dialog via HOME > XML parsing rules (sub button of File Types & Parsing Rules) |
In the Edit Methods Dialog, click on the browse button under Template to point to the XML document you wish to create the rules for.
A list of elements and attributes (Methods) now displays. By selecting suitable methods, you can instruct Alchemy CATALYST on processing XML documents.
By selecting an existing Rule name, you can modify or append to this rule. Selecting a template will not overwrite the existing list of elements and attributes but append to the list, highlighting in green to the new elements which were not in the existing rule.
|
Preparing a parsing rule for a localization project? Load the different XML files from your project as Templates to draw a comprehensive list of ALL the elements and attributes. This helps create one rule to suit all XML files for that project. |
Click the Clear List to remove all Elements and Attributes from the Methods list and start again. Select a template again to load a new set of Methods.
To select elements & attributes content for translation, simply double-click on the labels. Its color changes when it is selected for translation.
In the picture above, the "column" element has been selected as translatable and is highlighted. All other elements & attributes in white will not be parsed in the string list using this rule.
Click on Toggle All to set all elements & attributes as translatable. Click again on the button to deselect all as translatable.
The Elements count is the number of elements & attributes listed, regardless of being selected for translation or not. When appending to an existing rule, selecting a new template, all elements and attributes which are new to the list have a green background as seen in the picture above. The Elements count total includes the new green elements but gives a count of the new elements in brackets.
Once you have selected each elements & attributes for translation you can save the rule by clicking OK. And then OK again on the ezParse dialog.
Your Rule is now automatically saved in the Alchemy CATALYST registry. Next time you insert an XML document into a Project TTK, you will be prompted to select the appropriate rule for your XML document from a list displayed on screen. Alchemy CATALYST will then process the XML document based on the rule you have selected and display only those elements specified for translation in the workspace window.
Users may switch, create or delete any file extension. With a file extension selected, all available rules are listed in the dropdown. Again, select, create or delete any rule as needed.
Duplicate an existing rule to build on using the Copy current parsing rule button .
If modifications are made to any rule and you switch to a different one, CATALYST will prompt to Save the changes before the switch.
There is a convenient easy access button to view and edit your Segmentation settings without exiting the Edit Methods dialog with the button.
This facility allows users to change Segmentation settings on the fly and see the impact it has, if any, on the current XML parsing rules created.
There are several methods available to process element & attributes in your XML parsing rules.
|
ID |
||
|
Select this method if an element can be identified using an unique ID. This is very useful for aligning XML documents or improving the accuracy of translation re-use. |
||
|
Locked |
||
|
Select this method to lock an element or attribute. Applying a lock ensures that this element or attribute is displayed but cannot be modified during the translation process.
This is useful if for example you need to display text with contextual properties but should not be treated as localizable. |
||
|
In-Line |
||
|
Select this method to identify elements and attributes that are to be treated as inline tags.
Examples of such a elements would be bold or underline tags. This is frequently used when translating paragraph based text segments within XML documents.
Below, the bold <B> and Italic <I> tags are not treated as inline tags. As a result, the paragraph is segmented by the presence of those tags, not ideal:
Settings the 2 tags as inline, the <B> and <I> become a localizable part of the segment and the paragraph is segmented by sentence:
|
||
|
Memo |
||
|
Select this method if an element/attribute stores information to be parsed into the Memo field of another translatable element/attribute.
When selecting an element/attribute as Memo, you must link to the localizable element/attribute it is connected with in the Condition field. In the example below, the attribute Note needs to be parsed as a memo for the localizable attribute Value. Both are attributes of the LocalizedValue element. Using Xpath rules, the condition is ../@Value. Where ".." means go up an element (in this case come out of the current attribute), "/@Value" means go to the attribute (@) Value.
|
||
|
Context |
||
|
Select this method if an element stores Visual context information which should be parsed into the Context link field of another element/attribute. Example, as per Memo above, use the XPath ../@Label to associate the Context link to that localizable attribute.
|
||
|
Max Length |
||
Select this method if an element stores a size limit for the translation (in characters) which should be parsed into the Maximum size field of another element/attribute. Example, use the XPath .. to associate the MaxLength attribute to the parent localizable element.
|
|||
|
Conditional |
||
|
Select this method if you want to include an element or attribute for translation based on a condition.
In the example below, the contents of the column element are to be parsed as localizable only if the attribute translate set with value "yes" is present.
|
||
|
Store translation in |
||
|
Select this method to specify the element that will be used to store the translation when working on multilingual XML files.
The condition field must include the xpath to the source segment (in relation to the selected localizable element/attribute) and the Store translation in field should include the xpath to the translation space (in relation to the source element/attribute).
|
||
|
Code Segment |
||
Select this method to identify elements that contain code (for example, JavaScript, ASP, CGI, Pearl) which require sub parsing. Alchemy CATALYST can be configured to parse that code segment using either a text parsing rule or the HTML parser.
A typical case needing to use this method is CDATA sections, which are typically contents within an XML document which should not be treated as XML.
Selecting Code Segment, you then select the Type of parser to sub parse with. It can be a Text parsing rule (pre configured), for which you select the file extension in the Type column, and the Rulename in the Parser column.
Or it can be an HTML parsing rule. In which case you select HTML in the Type column which automatically sets the Parser column to Default.
|
|||
|
|
If you have XML files with continually changing structure/element names or lots of different files with different attribute and element names then you may find that it requires a lot of work to create an individual ezParse rule for each XML file to be localized. Alchemy CATALYST simplifies this process by providing a rule called Show All. This is a default rule that displays all elements/attributes in an XML document so that it can easily be translated without creating a custom rule for it.
This Show All rule is always presented as an option when an XML document is inserted into a Project TTK.
Learn more about XML Documents.
Learn how to specify conditions in ezParse rules.
Learn how to define a translation-target in multi-lingual XML documents.