public static ImmutableList<SoyMsgPart> convertMsgPartsToEmbeddedIcuSyntax(
      ImmutableList<SoyMsgPart> origMsgParts) {

    // If origMsgParts doesn't have plural/select parts, simply return it.
    if (!MsgPartUtils.hasPlrselPart(origMsgParts)) {
      return origMsgParts;
    }

    // Build the new msg parts.
    ImmutableList.Builder<SoyMsgPart> newMsgPartsBuilder = ImmutableList.builder();
    StringBuilder currRawTextSb = new StringBuilder();

    convertMsgPartsHelper(
        newMsgPartsBuilder, currRawTextSb, origMsgParts, /* isInPlrselPart= */ false);
    if (currRawTextSb.length() > 0) {
      newMsgPartsBuilder.add(SoyMsgRawTextPart.of(currRawTextSb.toString()));
    }

    return newMsgPartsBuilder.build();
  }
public static ImmutableList < SoyMsgPart > convertMsgPartsToEmbeddedIcuSyntax ( ImmutableList < SoyMsgPart > origMsgParts ) { if ( ! MsgPartUtils . hasPlrselPart ( origMsgParts ) ) { return origMsgParts ; } ImmutableList . Builder < SoyMsgPart > newMsgPartsBuilder = ImmutableList . builder ( ) ; StringBuilder currRawTextSb = new StringBuilder ( ) ; convertMsgPartsHelper ( newMsgPartsBuilder , currRawTextSb , origMsgParts , false ) ; if ( currRawTextSb . length ( ) > 0 ) { newMsgPartsBuilder . add ( SoyMsgRawTextPart . of ( currRawTextSb . toString ( ) ) ) ; } return newMsgPartsBuilder . build ( ) ; }
Given a list of msg parts: (a) if it contains any plural/select parts, then builds a new list
of msg parts where plural/select parts in the original msg parts are all embedded as raw text
in ICU format, (b) if it doesn't contain any plural/select parts, then simply returns the
original msg parts instead of creating a new list of identical msg parts.

@param origMsgParts The msg parts to convert.
@return A new list of msg parts with embedded ICU syntax if the original msg parts contain
plural/select parts, otherwise the original msg parts.