// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
// cSpell: ignore fooba xral
export component X {
property <string> t1: @tr("fo{}oo", 42px);
// > <error{Cannot convert length to string. Divide by 1px to convert to a plain number}
property <string> t2: @tr("foo{0️⃣}bar", 45);
// > <error{Invalid '{...}' placeholder in format string. The placeholder must be a number, or braces must be escaped with '{{' and '}}'}
property <string> t6: @tr("foo{", 45);
// ^error{Unterminated placeholder in format string. '{' must be escaped with '{{'}
property <string> t7: @tr("foo{bar", 45);
// > <error{Unterminated placeholder in format string. '{' must be escaped with '{{'}
property <string> t8: @tr("foo{bar}bar", 45);
// > <error{Invalid '{...}' placeholder in format string. The placeholder must be a number, or braces must be escaped with '{{' and '}}'}
property <string> t9: @tr("foo{}bar");
// > <error{Format string contains 1 placeholders, but only 0 extra arguments were given}
property <string> t10: @tr("foo{}ba{}r", 42);
// > <error{Format string contains 2 placeholders, but only 1 extra arguments were given}
property <string> t11: @tr("foo{65535}ba{2147483647}r");
// > <error{Invalid '{...}' placeholder in format string. The placeholder must be a number, or braces must be escaped with '{{' and '}}'}
// > <^error{Format string contains 65536 placeholders, but only 0 extra arguments were given}
property <string> t12: @tr("foo{45}bar", 44);
// > <error{Format string contains 46 placeholders, but only 1 extra arguments were given}
property <string> t13: @tr("foo{0}ba{}r", 44, 42);
// > <error{Cannot mix positional and non-positional placeholder in format string}
property <string> t14: @tr("foo{}ba{1}r", 44, 42);
// > <error{Cannot mix positional and non-positional placeholder in format string}
property <string> t15: @tr("fooba🥸{3}🥸r", 44, 42, 45);
// > <error{Format string contains 4 placeholders, but only 3 extra arguments were given}
property <string> t16: @tr("foo{} {}ba{}r", 44, 42);
// > <error{Format string contains 3 placeholders, but only 2 extra arguments were given}
property <string> t17: @tr("fo{}o}r", 44, 42);
// ^error{Unescaped '}' in format string. Escape '}' with '}}'}
property <string> ctx: @tr("foo" => "fo{}or{}", 42px);
// > <error{Cannot convert length to string. Divide by 1px to convert to a plain number}
// > <^error{Format string contains 2 placeholders, but only 1 extra arguments were given}
// Bad escape in @tr format string
property <string> t18: @tr("foo\xbar");
// ><error{Unknown escape sequence. Use '\\' to escape a literal backslash}
// Escape before format error: \n shifts the source map
property <string> t19: @tr("a\nb{bad}", 1);
// > <error{Invalid '{...}' placeholder in format string. The placeholder must be a number, or braces must be escaped with '{{' and '}}'}
property <string> t20: @tr("a\nb\nc{bad}", 1);
// > <error{Invalid '{...}' placeholder in format string. The placeholder must be a number, or braces must be escaped with '{{' and '}}'}
// Unterminated placeholder after escape
property <string> t21: @tr("x\ny{", 1);
// ^error{Unterminated placeholder in format string. '{' must be escaped with '{{'}
// Unescaped } after escape
property <string> t22: @tr("\n}rest", 1);
// ^error{Unescaped '}' in format string. Escape '}' with '}}'}
// Bad escape in @tr context string
property <string> t23: @tr("ctx\x" => "hello");
// ><error{Unknown escape sequence. Use '\\' to escape a literal backslash}
// Bad escape in @tr plural string
property <string> t24: @tr("one" | "plu\xral" % 5);
// ><error{Unknown escape sequence. Use '\\' to escape a literal backslash}
}