XLIFF Filter doesn't parse decimal match-quality values

This affects attempts to parse alt-trans data from XLIFF produced by WorldServer (the old "Idiom XLIFF", not the SDLXLIFF which can be produced from the newer FTS filters). It produces alt-trans blocks like this:

#!xml

<alt-trans match-quality="100.00" origin="Default">

This alt-trans will be parsed but will report a score of 0 in Okapi, because of this code from XLIFFFilter#processStartAltTrans():

#!java
        if ( !Util.isEmpty(tmp) ) {
            if ( Character.isDigit(tmp.charAt(0)) ) {
                if ( tmp.endsWith("%") ) tmp = tmp.substring(0, tmp.length()-1);
                try {
                    altTransQuality = Integer.valueOf(tmp);
                    if ( altTransQuality < 1 ) altTransQuality = -1;
                }
                catch ( NumberFormatException e ) {
                    // Do nothing
                }
            }
        }

I think it's reasonable to discard the precision and normalize the value to an int.

Assignee Loading
Time tracking Loading