Search in sources :

Example 11 with Variables

use of com.squarespace.template.Variables in project template-compiler by Squarespace.

the class InternationalFormattersTest method format.

private String format(String locale, Formatter impl, Arguments args, String json) throws CodeException {
    Context ctx = new Context(JsonUtils.decode(json), Locale.forLanguageTag(locale));
    impl.validateArgs(args);
    Variables variables = new Variables("@", ctx.node());
    impl.apply(ctx, args, variables);
    return variables.first().node().asText();
}
Also used : Context(com.squarespace.template.Context) Variables(com.squarespace.template.Variables)

Aggregations

Context (com.squarespace.template.Context)11 Variables (com.squarespace.template.Variables)11 Arguments (com.squarespace.template.Arguments)3 Locale (java.util.Locale)1