use of com.google.template.soy.soytree.MsgNode.PlaceholderInfo in project closure-templates by google.
the class MsgUtils method buildMsgPartsForChildren.
// -----------------------------------------------------------------------------------------------
// Private helpers for building the list of message parts.
/**
* Builds the list of SoyMsgParts for all the children of a given parent node.
*
* @param parent Can be MsgNode, MsgPluralCaseNode, MsgPluralDefaultNode, MsgSelectCaseNode, or
* MsgSelectDefaultNode.
* @param msgNode The MsgNode containing 'parent'.
*/
private static ImmutableList<SoyMsgPart> buildMsgPartsForChildren(BlockNode parent, MsgNode msgNode) {
ImmutableList.Builder<SoyMsgPart> msgParts = ImmutableList.builder();
for (StandaloneNode child : parent.getChildren()) {
if (child instanceof RawTextNode) {
String rawText = ((RawTextNode) child).getRawText();
msgParts.add(SoyMsgRawTextPart.of(rawText));
} else if (child instanceof MsgPlaceholderNode) {
PlaceholderInfo placeholder = msgNode.getPlaceholder((MsgPlaceholderNode) child);
msgParts.add(new SoyMsgPlaceholderPart(placeholder.name(), placeholder.example()));
} else if (child instanceof MsgPluralNode) {
msgParts.add(buildMsgPartForPlural((MsgPluralNode) child, msgNode));
} else if (child instanceof MsgSelectNode) {
msgParts.add(buildMsgPartForSelect((MsgSelectNode) child, msgNode));
}
}
return msgParts.build();
}
Aggregations