use of com.squarespace.template.Variables in project template-compiler by Squarespace.
the class InternationalFormattersTest method format.
private String format(CLDR.Locale locale, Formatter impl, Arguments args, String json) throws CodeException {
Context ctx = new Context(JsonUtils.decode(json));
ctx.cldrLocale(locale);
impl.validateArgs(args);
Variables variables = new Variables("@", ctx.node());
impl.apply(ctx, args, variables);
return variables.first().node().asText();
}
use of com.squarespace.template.Variables in project template-compiler by Squarespace.
the class LegacyMoneyFormatFactoryTest method cldr.
private String cldr(CLDR.Locale locale, String currency, String number, boolean narrow) throws CodeException {
Arguments args = mk.args(narrow ? " symbol:narrow" : " ");
CLDR_MONEY.validateArgs(args);
Context ctx = new Context(moneyJson(number, currency));
ctx.cldrLocale(locale);
Variables variables = new Variables("@", ctx.node());
CLDR_MONEY.apply(ctx, args, variables);
return variables.first().node().asText();
}
use of com.squarespace.template.Variables in project template-compiler by Squarespace.
the class UnitFormattersTest method format.
private static String format(CLDR.Locale locale, Formatter formatter, Arguments args, String json) throws CodeException {
Context ctx = new Context(JsonUtils.decode(json));
ctx.cldrLocale(locale);
formatter.validateArgs(args);
Variables variables = new Variables("@", ctx.node());
formatter.apply(ctx, args, variables);
return variables.first().node().asText();
}
use of com.squarespace.template.Variables in project template-compiler by Squarespace.
the class DecimalFormatterTest method format.
private static String format(String locale, Arguments args, String json) throws CodeException {
Context ctx = new Context(JsonUtils.decode(json));
ctx.javaLocale(Locale.forLanguageTag(locale));
DECIMAL.validateArgs(args);
Variables variables = new Variables("@", ctx.node());
DECIMAL.apply(ctx, args, variables);
return variables.first().node().asText();
}
use of com.squarespace.template.Variables in project template-compiler by Squarespace.
the class LegacyMoneyFormatFactoryTest method legacy.
private String legacy(String locale, String currency, String number) throws CodeException {
Arguments args = mk.args(" " + locale);
LEGACY_MONEY.validateArgs(args);
Context ctx = new Context(moneyJson(number, currency));
Variables variables = new Variables("@", ctx.node());
LEGACY_MONEY.apply(ctx, args, variables);
return variables.first().node().asText();
}