private String adjustForContext(String result) {
        if (result != null && result.length() > 0 && UCharacter.isLowerCase(result.codePointAt(0))) {
            DisplayContext capitalization = getContext(DisplayContext.Type.CAPITALIZATION);
            if (  capitalization==DisplayContext.CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
                  (capitalization == DisplayContext.CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForListOrMenu) ||
                  (capitalization == DisplayContext.CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone) ) {
                if (capitalizationBrkIter == null) {
                    // should only happen when deserializing, etc.
                    capitalizationBrkIter = BreakIterator.getSentenceInstance(locale);
                }
                return UCharacter.toTitleCase(locale, result, capitalizationBrkIter,
                                UCharacter.TITLECASE_NO_LOWERCASE | UCharacter.TITLECASE_NO_BREAK_ADJUSTMENT);
            }
        }
        return result;
    }
private String adjustForContext ( String result ) { if ( result != null && result . length ( ) > 0 && UCharacter . isLowerCase ( result . codePointAt ( 0 ) ) ) { DisplayContext capitalization = getContext ( DisplayContext . Type . CAPITALIZATION ) ; if ( capitalization == DisplayContext . CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE || ( capitalization == DisplayContext . CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForListOrMenu ) || ( capitalization == DisplayContext . CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone ) ) { if ( capitalizationBrkIter == null ) { capitalizationBrkIter = BreakIterator . getSentenceInstance ( locale ) ; } return UCharacter . toTitleCase ( locale , result , capitalizationBrkIter , UCharacter . TITLECASE_NO_LOWERCASE | UCharacter . TITLECASE_NO_BREAK_ADJUSTMENT ) ; } } return result ; }
Adjust capitalization of formatted result for display context