use of com.squarespace.template.Variables in project template-compiler by Squarespace.
the class DecimalFormatterTest method format.
private static String format(CLDR.Locale locale, Arguments args, String json) throws CodeException {
Context ctx = new Context(JsonUtils.decode(json));
ctx.cldrLocale(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 MoneyFormatterTest method format.
private static String format(CLDR.Locale locale, Arguments args, String json) throws CodeException {
Context ctx = new Context(JsonUtils.decode(json));
ctx.cldrLocale(locale);
MONEY.validateArgs(args);
Variables variables = new Variables("@", ctx.node());
MONEY.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(String tag, String currency, String number, boolean narrow) throws CodeException {
Arguments args = mk.args(narrow ? " symbol:narrow" : " ");
CLDR_MONEY.validateArgs(args);
Locale locale = Locale.forLanguageTag(tag);
Context ctx = new Context(moneyJson(number, currency), new StringBuilder(), 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 MoneyFormatterLegacyTest 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));
MONEY.validateArgs(args);
Variables variables = new Variables("@", ctx.node());
MONEY.apply(ctx, args, variables);
return variables.first().node().asText();
}
use of com.squarespace.template.Variables in project template-compiler by Squarespace.
the class MoneyFormatterTest 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));
MONEY.validateArgs(args);
Variables variables = new Variables("@", ctx.node());
MONEY.apply(ctx, args, variables);
return variables.first().node().asText();
}