Skip to content

[transloco-validator] check for missing curly brace #493

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

Open
Serrulien opened this issue Aug 25, 2021 · 0 comments
Open

[transloco-validator] check for missing curly brace #493

Serrulien opened this issue Aug 25, 2021 · 0 comments
Labels
enhancement New feature or request PRs welcome

Comments

@Serrulien
Copy link
Contributor

Is your feature request related to a problem? Please describe.

In one of my translation, there is a missing curly brace: "manage-space-form.default-title-for-slot": "Created by { creatorFirstName }} {{ creatorLastName }}".

So far transloco-validor doesn't check for such mistakes. The only way to find it is by the error logged at runtime :

ERROR
Object {
    expected: Array(10) [ {…}, {…}, {…}, … ]
    ​found: "}"
    ​location: Object { start: {…}, end: {…} }
    ​message: "Expected \"#\", \"{\", doubled apostrophe, end of input, escaped string, or plain char but \"}\" found."
    ​name: "SyntaxError"
    ​stack: ""
}

The error message is quite cryptic and you can't tell at first glance that it is due to an invalid translation message.

Describe the solution you'd like

We would like to assert at build time that our translation files contains messages that will be correctly parsed. One of the checks could search for missing curly braces.

Additional context

@ngneat/transloco-validator@1.0.1

Contribution

I want to make a pull request for this feature:
[ ] Yes! 🚀
[X] Maybe next time

@shaharkazaz shaharkazaz added enhancement New feature or request PRs welcome labels Sep 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PRs welcome
Projects
None yet
Development

No branches or pull requests

2 participants