@Override public JsExpr computeForJsSrc(List<JsExpr> args) { BidiGlobalDir bidiGlobalDir = bidiGlobalDirProvider.get(); if (bidiGlobalDir.isStaticValue()) { return new JsExpr( (bidiGlobalDir.getStaticValue() < 0) ? "'right'" : "'left'", Integer.MAX_VALUE); } return new JsExpr( "(" + bidiGlobalDir.getCodeSnippet() + ") < 0 ? 'right' : 'left'", Operator.CONDITIONAL.getPrecedence()); }
@Override public GoExpr computeForGoSrc(List<GoExpr> args) { BidiGlobalDir bidiGlobalDir = bidiGlobalDirProvider.get(); if (bidiGlobalDir.isStaticValue()) { return toStringGoExpr( GoCodeUtils.genNewStringData( (bidiGlobalDir.getStaticValue() < 0) ? "\"right\"" : "\"left\"")); } return toStringGoExpr( GoCodeUtils.genNewStringData( GoCodeUtils.genFunctionCall( GoCodeUtils.UTILS_LIB + ".BidiStartEdge", bidiGlobalDir.getCodeSnippet()))); }
@Override public JavaExpr computeForJavaSrc(List<JavaExpr> args) { BidiGlobalDir bidiGlobalDir = bidiGlobalDirProvider.get(); if (bidiGlobalDir.isStaticValue()) { return toStringJavaExpr( JavaCodeUtils.genNewStringData( (bidiGlobalDir.getStaticValue() < 0) ? "\"right\"" : "\"left\"")); } String bidiFunctionName = SoyBidiUtils.class.getName() + ".getBidiFormatter(" + bidiGlobalDir.getCodeSnippet() + ").startEdge"; return toStringJavaExpr( JavaCodeUtils.genNewStringData(JavaCodeUtils.genFunctionCall(bidiFunctionName))); }
private <T> WriteContinuation startRender(AdvisingAppendable out) throws IOException { RenderContext context = contextBuilder .withMessageBundle(msgs) .withActiveDelPackageSelector(activeDelegatePackages) .build(); BidiGlobalDir dir = BidiGlobalDir.forStaticLocale(msgs.getLocaleString()); Scoper scoper = new Scoper(apiCallScope, dir, msgs.getLocaleString()); CompiledTemplate template = templateFactory.create(data, ij); return doRender(template, scoper, out, context); }