compiler: Accept additional comparison syntax for plural forms in bun…
…dled translations
Tolgee produces these plural forms and they cause the compiler to panic.
Upstream PR: https://github.com/tolgee/tolgee-platform/pull/3346
I believe gettext doesn't understand these either and that toglee is producing invalid expressions.
But this patch can't hurt anyway.
I'm just curious where it panics?
This is the panic:
thread 'translations::plural_rule_parser::test_parse_rule_expression' (33972856) panicked at internal/compiler/translations.rs:465:20:
parse error: ParseError(unexpected token, rest="= 1)")
The comparison operator code tries to strip, so with for example === it will strip the == and then expect the next bit (=) to be an operand. That's not going to work :)
I believe gettext doesn't understand these either and that toglee is producing invalid expressions.
I agree. I've sent them an email.
I proposed a fix upstream.
This is the panic:
thread 'translations::plural_rule_parser::test_parse_rule_expression' (33972856) panicked at internal/compiler/translations.rs:465:20: parse error: ParseError(unexpected token, rest="= 1)")
Ah but that's the test. I thought the compiler was panicking when running. But ideally, I hope it shows an error.
Ah but that's the test. I thought the compiler was panicking when running.
Right, the compiler doesn't panic. The app's build process aborted in build.rs because of the error.