Quality Checks are critical to ensuring translations reach the Published step, as you expect them to. Smartling offers a range of Quality Checks that cover industry-standard checks, which can all be added to any Quality Check Profile on your account. However, you may want to create a custom quality check to target a specific element in a translation.
Custom Quality Checks allow you to apply specific logic to check translations for a desired result, using Regular Expression (RegEx). Regex is a powerful function that allows you to search for a pattern of characters, which facilitates greater flexibility to customize quality checks.
The following are some good resources to learn more about using regex:
How Custom Quality Checks Work
Here is a broad overview of how Custom Quality Checks work:
- A Check type is set.
- Source regex is set to evaluate the source string for pattern matches.
- Target regex is set to evaluate the target string for pattern matches.
- Once the Quality Check has been created, you can configure its severity from low, medium or high.
- The results of the source and translation pattern matches under the specified Quality Check type is used to evaluate whether the translations saved by linguists in the CAT Tool failed or passed the Quality Check. If the severity level is set too high, linguists will be unable to submit a translation that failed the Quality Check.
If a source regex pattern is not found in the source string, the Quality Checks stop, regardless if a target pattern is found in the translation. In some cases, your Quality Check might not require a source string evaluation; in this case, you can set the Quality Check to match "anything" in the source string by inserting .*?
as the source regex. This pattern could also be understood as "check all translations".
Important Consideration
It is important to note that when creating a custom regex quality check for HTML tags, you could end up getting numerous false positives. This is because The CAT Tool escapes <>
characters as <>
Here's an example of a correct expression:
(?:<|<)\/?\d(?:>|>)
Example Custom Quality Check
Custom Quality Checks are custom to individual use cases and requirements. Most, if not all, Quality Checks are already covered in Smartling's standard offering, however there may be something specific to your localization process that you need evaluated and monitored - this check will be custom to you.
As a result, the examples provided are mostly already covered in Smartling's standard range of Quality Checks; however, they are provided to guide and to help you understand how Custom Quality Checks work. Here’s an example of a Custom Quality Check that is similar to using a Blocklist Quality Check.
Check Type: Forbidden in translation
Source Regex: .*?
Target Regex: &
This says that no translation should contain an ampersand character "&". If a translation is saved in the CAT Tool with "&", a Quality Check warning is flagged.
Example String Resulting in a Quality Check warning
Source |
Translation |
Explanation |
Hello & how are you? |
Bonjour & comment allez-vous? |
The target regex pattern was found in the translation and, under this Quality Check type, it should be forbidden. |
Check Types
There are three types of checks that can be customized:
- Count mismatch in translation
- Forbidden in translation
- Missing in translation
Count mismatch in translation
The source string is evaluated against regex and the number of times that the match occurs is summed. The translation is evaluated against the translation regex and the number of times that the match occurs is summed. If these counts are not the same, the check fails and the warning is produced. In other words, count the number of times the source regex pattern appears in the source string, and compare that to the number of times the target pattern appears in the translation, they should be the same.
It is possible to have different patterns for both source and target.
Example Custom Quality Check
Description: Check for copyright characters
Source Regex: ©
Target Regex:©
This evaluates the number of times that source has © character, and checks that the translation must contain the same numbers of © characters. In other words, both the source and the target must have the same number of copyright symbols. If not, a Quality Check warning is flagged.
Example String Resulting in a Quality Check warning
Source |
Translation |
Explanation |
Copyright © 2021 Smartling, Inc. All rights reserved. |
Copyright © 2021 Smartling, Inc. © |
The source regex checked that the source string contained "©", and counted the number of times it appeared. The target regex pattern checked that the translation contained "©", and counted the number of times it appeared. Because there was a mismatch in the number of times "©" was found in the translation, under this Quality Check type, that is not acceptable and a Quality Check warning was flagged. |
Forbidden in translation
This Check type evaluates if the source string has a match for the regex, then the translation must not match with the target regex. If it does, the check fails and the warning is produced. In other words, if the specified target pattern is present, flag a Quality Check warning.
Forbidden in translation checks are most useful to ensure language-specific formatting rules are followed, especially if the Smartling standard Quality Checks do not already cover the case.
Example #1 Custom Quality Check
Description: French punctuation spacing
Language-specific setting: fr-FR
Source Regex: .*?
Target Regex: (\w)(\?|\!)
This says that for fr-FR language, if the source string contains anything .*?
, check all translations to make sure any word character (equivalent to [a-zA-Z0-9_]) (\w)
, does not come directly before the question or exclamation mark (\?|\!)
. In other words, there must be a space before a question or exclamation mark in French translations. If not, a Quality Check warning is flagged.
The target pattern must be found in the translation to trigger the "forbidden" check. The idea is, the target regex contains a pattern that we don't want in our translations. If it does match, Smartling will warn.
Example String Resulting in a Quality Check warning
Source |
Translation |
Explanation |
What day is it? |
Quel jour est-il? |
The source regex checked that the source string contained "anything". The target regex pattern, together with the language-specific setting, checked for a French word immediately before a question or exclamation mark. Because there was no space between the last word and the question mark, under this Quality Check type, that is not acceptable and a Quality Check warning was flagged. |
Example #2 Custom Quality Check
Description: Proper Chinese Punctuation
Language-specific setting: zh-TW, zh-CN
Source Regex: .*?
Target Regex: [\p{Lo}][\.\!\?]
This says that for zh-TW and zh-CN languages, if the source string contains anything, check all translations to see if roman character punctuation (period, exclamation, question) [\.\!\?]
, immediately follows any ideographic character [\p{Lo}]
. If any one of those 3 roman character punctuation marks is found immediately after an ideographic character, a Quality Check warning is flagged.
Example String Resulting in a Quality Check warning
Source |
Translation |
Explanation |
What day is it? |
今天是什麼日子? |
The source regex checked that the source string contained "anything". The target regex pattern checked for a word immediately before a roman character punctuation. Because there is a roman ? , under this Quality Check type, that is not acceptable and a Quality Check warning was flagged. The translator can correct this by using the ideographic (full-width) question mark character. |
Missing in translation
The source string is evaluated against the source regex pattern. The source string must contain at least one occurrence of the specified source regex pattern. As previously noted, if there isn’t at least one match in the source, the Quality Check stops.
When there is a match in the source, the translation is then evaluated against the target regex. There must be at least one match. If not, the check fails and the warning is produced.
Missing in translation is similar to Count mismatch in translation, except here, the source/target pattern only needs to appear once to pass the evaluation.
Example Custom Quality Check
Description: Check for copyright characters
Source Regex: ©
Target Regex:©
This evaluates the number of times that source has © character, and checks that the translation must contain at least one © character. In other words, if the source has any/at least one ©, then the target must also have at least one ©. If not, a Quality Check warning is flagged.
Example String Resulting in a Quality Check warning
Source |
Translation |
Explanation |
Copyright © 2021Smartling, Inc. All rights reserved. |
Copyright ® 2021Smartling, Inc. All rights reserved.? |
The source regex checked that the source string contained "©". The target regex pattern checked that the translation contained at least one "©". Because "© was not found even once in the translation, under this Quality Check type, that is not acceptable and a Quality Check warning was flagged. |
Create a Custom Quality Check
- Go to the Quality Check Profile you want to create a custom quality check in
- Scroll to the bottom of the list of Quality Checks to Custom Quality Checks
- Click New Custom Quality Check
- In the dialog, name the quality check (this will be displayed to linguists in the CAT Tool)
- You have the option to insert a description and warning message
- Select the check type from the dropdown
- Insert the source string regex
- Insert the translation (target) string expression
- Decide if the result of both the source and translation regex is case-sensitive or multi-line by selecting the checkboxes:
- Case-insensitive is selected by default. This means that neither expression is considered case-sensitive to pass the quality check.
- If you want the expression to be case-sensitive, unselect the checkbox.
- Multiline means to include line breaks, so source and translation strings can be two or more lines. It lets you specify expressions precisely, by matching content before or after a newline (line break), including the character immediately at the start of a line and immediately at the end. Because quality checks are on a segment-level, without multiline checked, a quality check of ^ $ will only match begin and end of the entire segment/string. However, with multiline checked, ^ $ will match the beginning and ending of lines in addition to the entire segment.
- This is particularly useful for translating subtitles.
- Case-insensitive is selected by default. This means that neither expression is considered case-sensitive to pass the quality check.
- Click Save