private static String cleanTranslationText ( final String input , final boolean removeWhitespaceFromStart , final boolean removeWhitespaceFromEnd ) { String retValue = XMLUtilities . cleanText ( input ) ; retValue = retValue . trim ( ) ; /* * When presenting the contents of a childless XML node to the translator, there is no need for white space padding. * When building up a translatable string from a succession of text nodes, whitespace becomes important. */ if ( ! removeWhitespaceFromStart ) { if ( PRECEEDING_WHITESPACE_SIMPLE_RE_PATTERN . matcher ( input ) . matches ( ) ) { retValue = " " + retValue ; } } if ( ! removeWhitespaceFromEnd ) { if ( TRAILING_WHITESPACE_SIMPLE_RE_PATTERN . matcher ( input ) . matches ( ) ) { retValue += " " ; } } return retValue ; }
Cleans a string for presentation to a translator