Inlicde code checker show wrong missing code

Issue #910 resolved
YvesS created an issue

In some cases the inline code checker can point to the wrong missing codes. For example when the source has two bold elements in the source and one of the element is missing in the target. The checker will report the existing codes rather than the missing one. This is visible only when the option to use generic codes is turned on.

In the following example, the checker report <3> and </3> missing rather than <2> and </2>.

    ITextUnit tu = new TextUnit();
    TextContainer srcTc = tu.getSource();
    TextFragment srcFrag = srcTc.getFirstContent();
    srcFrag.append(TagType.OPENING, "a", "<a>", 1);
    srcFrag.append(TagType.CLOSING, "a", "</a>", 1);
    srcFrag.append(TagType.OPENING, "b", "<b>", 2);
    srcFrag.append(TagType.CLOSING, "b", "</b>", 2);
    srcFrag.append(TagType.OPENING, "b", "<b>", 3);
    srcFrag.append(TagType.CLOSING, "b", "</b>", 3);

    // Missing first <b></b>
    TextContainer trgTc = new TextContainer();
    TextFragment trgFrag = trgTc.getFirstContent();
    trgFrag.append(TagType.OPENING, "a", "<a>", 1);
    trgFrag.append(TagType.CLOSING, "a", "</a>", 1);
    trgFrag.append(TagType.OPENING, "b", "<b>", 3);
    trgFrag.append(TagType.CLOSING, "b", "</b>", 3);
    tu.setTarget(TARGET_LOCALE, trgTc);

This seems to be because the check is done on the IDs only when there is no original data. We should really check on IDs and type first, then on original data. Allowing codes with a different IDs but the same original data would technically be OK, but usually cause error as most tool check IDs rather than data.

Comments (3)

  1. Log in to comment