public class GenJsCodeVisitorAssistantForMsgs extends AbstractSoyNodeVisitor<Void>
Precondition: MsgNode should not exist in the tree.
| Modifier and Type | Field and Description |
|---|---|
protected CodeBuilder<JsExpr> |
jsCodeBuilder
The JsCodeBuilder to build the current JS file being generated (during a run).
|
protected GenJsCodeVisitor |
master
Master instance of GenJsCodeVisitor.
|
| Modifier | Constructor and Description |
|---|---|
protected |
GenJsCodeVisitorAssistantForMsgs(GenJsCodeVisitor master,
SoyJsSrcOptions jsSrcOptions,
JsExprTranslator jsExprTranslator,
GenCallCodeUtils genCallCodeUtils,
IsComputableAsJsExprsVisitor isComputableAsJsExprsVisitor,
CodeBuilder<JsExpr> jsCodeBuilder,
Deque<Map<String,JsExpr>> localVarTranslations,
TemplateAliases functionAliases,
GenJsExprsVisitor genJsExprsVisitor,
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 JsExpr |
genGoogMsgPlaceholderExpr(MsgPlaceholderNode msgPhNode)
Generates the JS expr for a given placeholder.
|
protected void |
visitMsgHtmlTagNode(MsgHtmlTagNode node)
Example:
|
protected void |
visitSoyNode(SoyNode node) |
visit, visitCallBasicNode, visitCallDelegateNode, visitCallNode, visitCallParamContentNode, visitCallParamNode, visitCallParamValueNode, visitChildren, visitChildrenAllowingConcurrentModification, visitCssNode, visitDebuggerNode, visitForeachIfemptyNode, visitForeachNode, visitForeachNonemptyNode, visitForNode, 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, visitXidNodevisitChildren, visitChildrenAllowingConcurrentModificationprotected final GenJsCodeVisitor master
protected final CodeBuilder<JsExpr> jsCodeBuilder
protected GenJsCodeVisitorAssistantForMsgs(GenJsCodeVisitor master, SoyJsSrcOptions jsSrcOptions, JsExprTranslator jsExprTranslator, GenCallCodeUtils genCallCodeUtils, IsComputableAsJsExprsVisitor isComputableAsJsExprsVisitor, CodeBuilder<JsExpr> jsCodeBuilder, Deque<Map<String,JsExpr>> localVarTranslations, TemplateAliases functionAliases, GenJsExprsVisitor genJsExprsVisitor, ErrorReporter errorReporter)
master - The master GenJsCodeVisitor instance.jsExprTranslator - Instance of JsExprTranslator to use.genCallCodeUtils - Instance of GenCallCodeUtils to use.isComputableAsJsExprsVisitor - The IsComputableAsJsExprsVisitor to use.jsCodeBuilder - The current JsCodeBuilder.localVarTranslations - The current local var translations.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.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 JsExpr genGoogMsgPlaceholderExpr(MsgPlaceholderNode msgPhNode)
msgPhNode - The placeholder to generate the JS expr for.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.