A method which just checks "textUnit.getChildElements("tuv").size() >=
2" would just add another level of indirection.  I don't think it would
aid readability here.

On 2013-08-01 10:22, David Mason wrote:
> In zanata-war/src/main/java/org/zanata/rest/service/TMXStreamingOutput.java:
> 
>>  
>>        while (iter.hasNext())
>>        {
>> -         SourceContents tu = iter.next();
>> -         net.sf.okapi.common.LocaleId sourceLocale = OkapiUtil.toOkapiLocale(tu.getLocale());
>> -         exportTUStrategy.exportTranslationUnit(tmxWriter, tu, sourceLocale);
>> -         if (writer.checkError())
>> +         TU tu = iter.next();
>> +         Element textUnit = exportStrategy.buildTU(tu);
>> +         // If there aren't any translations for this TU, we shouldn't include it.
>> +         // From the TMX spec: "Logically, a complete translation-memory
>> +         // database will contain at least two <tuv> elements in each translation
>> +         // unit."
>> +         if (textUnit != null && textUnit.getChildElements("tuv").size() >= 2)
> 
> This is too much unnecessary information. Much easier to follow if this
> check (and its comment) were moved to a method separate method, such as
> |hasAnyTranslations(textUnit)|.
> 
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/zanata/zanata-server/pull/78/files#r5519887>.
> 


-- 
Sean Flanigan

Senior Software Engineer
Engineering - Internationalisation
Red Hat