In there, the question was relating to how to create a check to detect when the content in brackets in the source is not identical in the target. For instance:
Source: Bill by Default [Label][Consultants].
Target: Cobrar por padrão [NotLabel][NotConsultants]
Xbench would detect this automatically as an error.
However, I am running checks with the solution posted there and I’m not getting exactly what I’m looking for. For instance, if there is a case in which only one of the brackets is correct, but the rest is incorrect, then Xbench considers it to be all correct.
I wanted to ask: Is there a way to create a check with Regex that detects when at least one of the target brackets is different from the ones in the source?
E.g.,
Source: Dear [First Name] [Last Name], you’ve won [PRIZE].
Target: Estimado/a [First Name] [Last Name], has ganado [UN PREMIO].
I would like Xbench to detect [UN PREMIO], even though the other brackets are correct.
In this case, the best approach would be to create a checklist for the number of text in brackets missing in target:
For instance, to check only segments with one text in brackets, use the following search:
Source: "(\[[^\]]+\])=1"
Target: -@1
Search mode: Regular Expressions
PowerSearch: On.
For instance, to check only segments with two texts in brackets, use the following search:
Source: "(\[[^\]]+\])=1.+(\[[^\]]+\])=2"
Target: -@1 OR -@2
Search mode: Regular Expressions
PowerSearch: On.
For instance, to check only segments with three text in brackets, use the following search:
Source: "(\[[^\]]+\])=1.+(\[[^\]]+\])=2.+(\[[^\]]+\])=3"
Target: -@1 OR -@2 OR -@3
Search mode: Regular Expressions
PowerSearch: On.
In segments detected source will be highlighted whereas the target text won’t. This means that at least one of the text in brackets is missing in source.
So it’s not about the amount of brackets, it seems:
1 has 2 tags, 2 of which are wrong.
2 has 1, 1 wrong.
3 has 3, 3 wrong.
4 has 2, 1 wrong.
5 has 3, 2 wrong.
6 has 3, 1 wrong.
7 has 4, 2 wrong.
8 has 4, 3 wrong.
If this is a one-off need, one quick and dirty trick could be the following:
In Xbench Export the project items to tab-delimited with Tools->Export Items.
With a text editor, do a global replace of [ with < and a global replace of ] with >.
Load the modified text file in Xbench as ongoing translation.
Run a QA of Tag Mismatches.
Otherwise you would need several checklist items, which is more elaborate and might miss some edge cases: one checklist item for the case of segments with one placeholder, one checklist item for the case of segments with two placeholders, etc.
Sadly, it’s not a one-off thing. I am creating a checklist to automate checks for a large amount of content and that additional step would be too time-consuming.
Also, creating a checklist based on the number of brackets in source has some issues, as the one for 1 bracket catches some, the one for 2 catches those and others, and so on, so there would be a lot of repetitions.
I was wondering how is it the tag mismatch works so well with angle brackets, but using square brackets causes so many issues. I assume the Tag Mismatch check (the regular one in the list of checks) does not use Regex, correct?
If it does use Regex, maybe we could adapt the expression for that one check to use square brackets?