mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-18 08:53:33 +00:00
i18n: unused-answers and Liquify skip messages translate for one item too
The script error for answers left in `answers` and Liquify's warning about objects under the brush that it left as they were built their singular by adding an empty suffix, so no catalog template could match the singular form, and neither message had a catalog row for either count. - Both messages are now built from complete singular and plural English sentences; `it was` and `they were` are part of the sentence. The English the commands return does not change. - Every complete-message catalog has an `@msgplural` row for each, with the language's own count forms. The tool name and the list of kinds stay as written.
This commit is contained in:
@@ -120,6 +120,18 @@ fn missing_or_mismatched_answer_rolls_back() {
|
||||
assert_eq!(s.script_report().unwrap()["dialogs"][0]["answer"], "missing");
|
||||
}
|
||||
|
||||
/// The error about answers left over names their count with the matching noun.
|
||||
#[test]
|
||||
fn unused_answers_are_counted_in_the_singular_and_the_plural() {
|
||||
let mut s = one_doc();
|
||||
let ok = json!({"kind": "alert", "value": "ok"});
|
||||
for (extra, says) in [(1, "`answers` has 1 answer the script did not use"), (2, "`answers` has 2 answers the script did not use")] {
|
||||
let given = Value::Array(vec![ok.clone(); extra + 1]);
|
||||
let e = headless(&mut s, "alert('x');", given).unwrap_err().to_string();
|
||||
assert!(e.contains(says), "{e}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_answers_are_rejected_before_run() {
|
||||
let mut s = one_doc();
|
||||
|
||||
Reference in New Issue
Block a user