public final class InsertMsgsVisitor extends AbstractSoyNodeVisitor<Void>
Important: Do not use outside of Soy code (treat as superpackage-private).
If the Soy tree doesn't contain plural/select messages, then after this pass, the Soy tree should no longer contain MsgFallbackGroupNodes, MsgNodes, MsgPlaceholderNodes, or MsgHtmlTagNodes. If the Soy tree contains plural/select messages, then the only messages left in the tree after this pass runs should be the plural/select messages.
Note that the Soy tree is usually simplifiable after this pass is run (e.g. it usually contains consecutive RawTextNodes). It's usually advisable to run a simplification pass after this pass.
| Modifier and Type | Class and Description |
|---|---|
static class |
InsertMsgsVisitor.EncounteredPlrselMsgException
Exception thrown when a plural or select message is encountered.
|
errorReporter| Constructor and Description |
|---|
InsertMsgsVisitor(SoyMsgBundle msgBundle,
boolean dontErrorOnPlrselMsgs,
ErrorReporter errorReporter) |
| Modifier and Type | Method and Description |
|---|---|
Void |
exec(SoyNode node)
Executes the function defined by this visitor.
|
protected void |
visitMsgFallbackGroupNode(MsgFallbackGroupNode node) |
protected void |
visitMsgHtmlTagNode(MsgHtmlTagNode node) |
protected void |
visitSoyNode(SoyNode node) |
visit, visitCallBasicNode, visitCallDelegateNode, visitCallNode, visitCallParamContentNode, visitCallParamNode, visitCallParamValueNode, visitChildren, visitChildrenAllowingConcurrentModification, visitCssNode, visitDebuggerNode, visitForeachIfemptyNode, visitForeachNode, visitForeachNonemptyNode, visitForNode, visitGoogMsgDefNode, visitGoogMsgRefNode, visitIfCondNode, visitIfElseNode, visitIfNode, visitLetContentNode, visitLetNode, visitLetValueNode, visitLogNode, visitLoopNode, visitMsgNode, visitMsgPlaceholderNode, visitMsgPluralCaseNode, visitMsgPluralDefaultNode, visitMsgPluralNode, visitMsgPluralRemainderNode, visitMsgSelectCaseNode, visitMsgSelectDefaultNode, visitMsgSelectNode, visitMsgSubstUnitNode, visitPrintDirectiveNode, visitPrintNode, visitRawTextNode, visitSoyFileNode, visitSoyFileSetNode, visitSwitchCaseNode, visitSwitchDefaultNode, visitSwitchNode, visitTemplateBasicNode, visitTemplateDelegateNode, visitTemplateNode, visitXidNodevisitChildren, visitChildrenAllowingConcurrentModificationpublic InsertMsgsVisitor(@Nullable SoyMsgBundle msgBundle, boolean dontErrorOnPlrselMsgs, ErrorReporter errorReporter)
msgBundle - The bundle of translated messages, or null to use the messages from the Soy
source.dontErrorOnPlrselMsgs - If set to true, then this pass won't report an error when
encountering a plural or select message. Instead, plural and select messages will simply
not be replaced (MsgNode left in the tree as-is). If set to false, then this pass
will throw an InsertMsgsVisitor.EncounteredPlrselMsgException when encountering a plural or
select message.public Void exec(SoyNode node)
NodeVisitorexec in interface NodeVisitor<SoyNode,Void>exec in class AbstractNodeVisitor<SoyNode,Void>node - The node to execute the function on.protected void visitMsgFallbackGroupNode(MsgFallbackGroupNode node)
visitMsgFallbackGroupNode in class AbstractSoyNodeVisitor<Void>protected void visitMsgHtmlTagNode(MsgHtmlTagNode node)
visitMsgHtmlTagNode in class AbstractSoyNodeVisitor<Void>protected void visitSoyNode(SoyNode node)
visitSoyNode in class AbstractSoyNodeVisitor<Void>node - the visited node.