mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
values: Don't allow translated strings in arrays
Gtk.Builder has no way to translate individual strings in a string array, so don't allow it in the syntax.
This commit is contained in:
parent
f3faf4b993
commit
55e5095fba
3 changed files with 16 additions and 0 deletions
|
@ -452,6 +452,14 @@ class ArrayValue(AstNode):
|
|||
range=quoted_literal.range,
|
||||
)
|
||||
)
|
||||
elif isinstance(value.child, Translated):
|
||||
errors.append(
|
||||
CompileError(
|
||||
"Arrays can't contain translated strings",
|
||||
range=value.child.range,
|
||||
)
|
||||
)
|
||||
|
||||
if len(errors) > 0:
|
||||
raise MultipleErrors(errors)
|
||||
|
||||
|
|
7
tests/sample_errors/translated_string_array.blp
Normal file
7
tests/sample_errors/translated_string_array.blp
Normal file
|
@ -0,0 +1,7 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
StringList {
|
||||
strings: [
|
||||
_("Test")
|
||||
];
|
||||
}
|
1
tests/sample_errors/translated_string_array.err
Normal file
1
tests/sample_errors/translated_string_array.err
Normal file
|
@ -0,0 +1 @@
|
|||
5,5,9,Arrays can't contain translated strings
|
Loading…
Add table
Add a link
Reference in a new issue