Correct Translation Tests

This test type is used when a particular source text or pattern must be translated in a particular way. Exact text strings or regular expression syntax may be used to identify the patterns that should exist in original and translated text. 

A pattern is specified for the original text and if found, the valid translation pattern is searched in the translated text.  If both patterns match, no error is raised. If the original pattern exists in the source, but the valid translation does not exist in the target, then an error is raised and listed in the results bar.

An example is when an imperial to metric conversion is required during translation, i.e. a test could verify if the word inch exists in the source, that cm exists in the target.

 

Description

Perform

A test will be carried out by the Validation Expert if this check-box is selected.

Test Name

Give the test a name so it can be easily identified for selection at a later time.

Original Term

Specify the pattern for which a specific translation should be used.

Valid Translation

Enter the valid translation pattern for the specified Original Term.

Description

A longer description about the test that explains when and how to use the test.

 

Loose versus Strict Checking

There are two ways to compare source and target text when defining a Correct Translation check.  Strict or exact matching is where the same text found in the original text must be found in the target - see below for an example of the regular expression syntax that can be used in this case. A looser form of checking caters for differences in text.

When creating validation tests, the effectiveness of the test can be verified by entering text that should pass or fail and verify the result with the pass and fail symbol in the dialog box.

Worked Example

Consider the currency amount €20.40.

For many Western European languages, this should be expressed as €20,40. i.e. the decimal separator must change from a dot to a comma.

A simple test can be created to validate this.  If the amount must match in the translated text, then a strict test could be used to validate that the dot changes to a comma, while also checking that the amount is consistent.  If the amount could be different and the test need only verify the dot to comma change, then a looser form of test could be used.

Regular Expression for Strict Checking

Groups in the Original Term field are denoted by the braces (). The screenshot shows that this example has two groups within the overall regular expression, one before the dot separator and one after.

 

Original Term = "€(\d+)\.(\d{2})"

Pattern

Meaning

The euro symbol must be present

(\d+)

The \d means a digit and the + means one or more. So this will match if one or more digits are present.

The braces mean that this is a group that may be later referred to.  As it is the first group, this is referred to by \1.  

\.

As a dot is meaningful in regular expression, if the pattern should match a dot, it must be escaped as it is here with a backslash.

(\d{2})

The \d means a digit and the {2} means that it will match 2 digits

€(\d+)\.(\d{2})

Match any euro amount with a number dot number format.

 

Valid Translation = "€\1,\2"

Pattern

Meaning

\1

This symbol refers to a group in the Original Term pattern (the first group).  It represents the piece of text that matched that group in the original segment.  To use that same piece of text when checking for a valid translation use \1.

\2

This symbol refers to a group in the Original Term pattern (the second group).  It represents the piece of text that matched that group in the original segment.  To use that same piece of text when checking for a valid translation use \2.

 

This valid translation definition indicates the euro symbol should be present in the translation along with whatever number was before the dot in the Original Term (i.e. \1), followed by a comma, followed by whatever number was after the dot in the Original Term (i.e. \2).

If the original text had the value "Total Price is €20.40", then only a translation containing "€20,40" will pass this strict test.

By default, patterns are regular expression.  Using the grouping syntax (e.g. \1, \2) in the valid translation definition results in that pattern becoming standard text, i.e. it is no longer a regular expression pattern.

 

 

Regular Expression Syntax for Loose Checking

The same Original Term syntax is used here, but without the braces because the numbers are not checked in the Valid Translation, so there is no need to define them.

If any currency amount is acceptable as a translation, then the same syntax can be used for the Valid Translation field.  This means that any number in the same format is acceptable.

 As this test is defined with less rigidity, any number will pass in the translation as long as it has a comma for the decimal separator.

Defining Search Patterns

By default, search patterns are regular expression patterns.  This gives significant power when defining customized tests.  Note, however, that to search for plain text characters such as dot (.) or slash (\), you must escape them.  See the Developing Regular Expressions topic for more information.

Online Tests

The Alchemy Support team host additional tests online and these are accessed via the Online Tests button.  Available tests are listed by name along with a short description and the value of the patterns being validated.  From here, any tests can be downloaded for use locally within the Validation Expert.  Before downloading a particular test, use the View button to examine the test in more detail verifying that it behaves appropriately.

Once downloaded, tests behave as if they were created locally.  They can be used, edited and shared among team members in the normal way.

Submitting Tests

Selecting one of your own local tests, press the Submit button to deliver that test to the Alchemy Support Team for inclusion with the online hosted tests.  Tests are verified to ensure they do what is stated and that they are appropriate for general hosting.  For this reason hosting of submitted tests is not immediate.
 

Online Symbols

Online Rule Symbols

Symbol

Description

Rule is on local machine only

Rule is available for download from the Alchemy Support cloud

Rule is on cloud and downloaded locally

Rule is a local rule that has been submitted for inclusion on cloud