Skip to content
Snippets Groups Projects
Commit a15808c5 authored by Ariya Hidayat's avatar Ariya Hidayat
Browse files

Custom expression: use i18n plural for giving error feedback (#14342)

parent 3907a7d3
Branches
Tags
No related merge requests found
import { t } from "ttag";
import { ngettext, msgid } from "ttag";
import { ExpressionVisitor } from "./visitor";
import { CLAUSE_TOKENS } from "./lexer";
......@@ -65,7 +65,11 @@ export function typeCheck(cst, rootType) {
const name = functionToken.name;
const expectedArgsLength = clause.args.length;
if (!clause.multiple && clause.args.length !== args.length) {
const message = t`Function ${name} expects ${expectedArgsLength} arguments`;
const message = ngettext(
msgid`Function ${name} expects ${expectedArgsLength} argument`,
`Function ${name} expects ${expectedArgsLength} arguments`,
expectedArgsLength,
);
this.errors.push({ message });
}
return args.map(arg => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment