public class GenJsCodeVisitorAssistantForMsgs extends AbstractSoyNodeVisitor<Void>
Precondition: MsgNode should not exist in the tree.
| Modifier and Type | Field and Description |
|---|---|
protected GenJsCodeVisitor |
master
Master instance of GenJsCodeVisitor.
|
protected TranslationContext |
translationContext |
| Modifier | Constructor and Description |
|---|---|
protected |
GenJsCodeVisitorAssistantForMsgs(GenJsCodeVisitor master,
SoyJsSrcOptions jsSrcOptions,
JsExprTranslator jsExprTranslator,
GenCallCodeUtils genCallCodeUtils,
IsComputableAsJsExprsVisitor isComputableAsJsExprsVisitor,
TemplateAliases functionAliases,
GenJsExprsVisitor genJsExprsVisitor,
TranslationContext translationContext,
ErrorReporter errorReporter) |
| Modifier and Type | Method and Description |
|---|---|
Void |
exec(SoyNode node)
Executes the function defined by this visitor.
|
String |
generateMsgGroupVariable(MsgFallbackGroupNode node)
Generates Javascript statements that declare a translated variable, returning the variable name
for the caller to output (as an expression).
|
protected CodeChunk.WithValue |
genGoogMsgPlaceholder(MsgPlaceholderNode msgPhNode)
Returns a code chunk for the given placeholder node.
|
protected JsCodeBuilder |
jsCodeBuilder()
The JsCodeBuilder to build the current JS file being generated (during a run).
|
protected void |
visitMsgHtmlTagNode(MsgHtmlTagNode node)
Example:
|
protected void |
visitSoyNode(SoyNode node) |
visit, visitCallBasicNode, visitCallDelegateNode, visitCallNode, visitCallParamContentNode, visitCallParamNode, visitCallParamValueNode, visitChildren, visitChildrenAllowingConcurrentModification, visitDebuggerNode, visitForeachIfemptyNode, visitForeachNode, visitForeachNonemptyNode, visitHtmlAttributeNode, visitHtmlAttributeValueNode, visitHtmlCloseTagNode, visitHtmlCommentNode, visitHtmlOpenTagNode, visitIfCondNode, visitIfElseNode, visitIfNode, visitLetContentNode, visitLetNode, visitLetValueNode, visitLogNode, visitLoopNode, visitMsgFallbackGroupNode, visitMsgNode, visitMsgPlaceholderNode, visitMsgPluralCaseNode, visitMsgPluralDefaultNode, visitMsgPluralNode, visitMsgSelectCaseNode, visitMsgSelectDefaultNode, visitMsgSelectNode, visitMsgSubstUnitNode, visitPrintDirectiveNode, visitPrintNode, visitRawTextNode, visitSoyFileNode, visitSoyFileSetNode, visitSwitchCaseNode, visitSwitchDefaultNode, visitSwitchNode, visitTemplateBasicNode, visitTemplateDelegateNode, visitTemplateNode, visitVeLogNodevisitChildren, visitChildrenAllowingConcurrentModificationprotected final GenJsCodeVisitor master
protected final TranslationContext translationContext
protected GenJsCodeVisitorAssistantForMsgs(GenJsCodeVisitor master, SoyJsSrcOptions jsSrcOptions, JsExprTranslator jsExprTranslator, GenCallCodeUtils genCallCodeUtils, IsComputableAsJsExprsVisitor isComputableAsJsExprsVisitor, TemplateAliases functionAliases, GenJsExprsVisitor genJsExprsVisitor, TranslationContext translationContext, ErrorReporter errorReporter)
master - The master GenJsCodeVisitor instance.jsExprTranslator - Instance of JsExprTranslator to use.genCallCodeUtils - Instance of GenCallCodeUtils to use.isComputableAsJsExprsVisitor - The IsComputableAsJsExprsVisitor to use.genJsExprsVisitor - The current GenJsExprsVisitor.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 JsCodeBuilder jsCodeBuilder()
public String generateMsgGroupVariable(MsgFallbackGroupNode node)
{msg desc="Link to help content."}Learn more{/msg}
{msg desc="Tells user how to access a product." hidden="true"}
Click <a href="}{$url}">here</a> to access {$productName}.
{/msg}
might generate
/** @desc Link to help content. * /
var MSG_UNNAMED_9 = goog.getMsg('Learn more');
var msg_s9 = MSG_UNNAMED_9;
/** @desc Tells user how to access a product.
* @hidden * /
var MSG_UNNAMED_10 = goog.getMsg(
'Click {$startLink}here{$endLink} to access {$productName}.',
{startLink: '<a href="' + opt_data.url + '">',
endLink: '</a>',
productName: opt_data.productName});
and return "MSG_UNNAMED_10".protected CodeChunk.WithValue genGoogMsgPlaceholder(MsgPlaceholderNode msgPhNode)
protected void visitMsgHtmlTagNode(MsgHtmlTagNode node)
<a href="http://www.google.com/search?hl=en
{for $i in range(3)}
¶m{$i}={$i}
{/for}
">
might generate
var htmlTag84 = (new soy.StringBuilder()).append('<a href="');
for (var i80 = 1; i80 < 3; i80++) {
htmlTag84.append('¶m', i80, '=', i80);
}
htmlTag84.append('">');
visitMsgHtmlTagNode in class AbstractSoyNodeVisitor<Void>protected void visitSoyNode(SoyNode node)
visitSoyNode in class AbstractSoyNodeVisitor<Void>node - the visited node.