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

Compile time checks #63

Open
woojiq opened this issue Sep 18, 2023 · 0 comments
Open

Compile time checks #63

woojiq opened this issue Sep 18, 2023 · 0 comments

Comments

@woojiq
Copy link

woojiq commented Sep 18, 2023

I didn't find any information about compile-time checks. If message in locale file is missing then string passed to macro will be displayed:

if locale.is_empty() {
return key.to_string();
}
return format!("{}.{}", locale, key);

Will it be hard to create a separate macro or add option for t!() to make sure the message I use exists in the locale file at compile time (like sqlx query! does)? This can be tricky, so maybe an easier way is to create xtask (or test) to check that all the messages I'm using in the code are defined. This way it can be easily integrated with CI.
All I want to achieve is if my app has passed CI, the locale files will have the appropriate content and the user won't see "en.wron_mesag".

Probably internationalization-rs can be used to see how they achieve compile time verification (using build.rs).

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

No branches or pull requests

1 participant