Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise error in parse_arg_id if a dot if found in the variable name #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MichaelHoste
Copy link

@MichaelHoste MichaelHoste commented Jan 17, 2023

We noticed that an ICU message looking like this is wrongly considered as a valid message:

{ count, plural, one {{results.length} result} other {{results.length} results} }

Note the use of the variable {results.length} instead of {count}, it could happen if the developer make a mistake while writing the ICU.

We checked and the same ICU triggers an error when parsed by the JS library @formatjs/icu-messageformat-parser

We improved a bit the parse_arg_id method to also raise an exception when dot (.) is found in a variable.
I hope it made sense.


Thank you for this gem that is really useful to us at Translation.io 🙂

`{ count, plural, one {{results.length} result} other {{results.length} results} }` was wrongly considered as a valid ICU
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant