-
-
Notifications
You must be signed in to change notification settings - Fork 349
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
Runtime only build breaks with missing keys despite formatFallback #768
Comments
Hi, @AlexandreBonaventure {
"foo {bar}": "foo {bar}",
"missing interpolation {bar}": "missing interpolation {bar}"
} |
Yes! That was on purpose, sorry if this was not clear enough. The point being that if for whatever reason you don't have the key in your message json it will throw an error. |
I see. But seems you just want to use runtime package, So I not sure should we change this behavior from thrown a error to print the string when we don't have Also I still think configure the key is a easy way since you have congfigured |
Yes exactly I wish I could just use the runtime to reduce bundle size. I know that right now I can keep using the compiler.
Well, not really, obviously the repo I created to highlight the issue is a minimal repro that is not really matching the complexity of a real-word use-case. Like I said our translations are handled with a third-party service and distributed accross multiple different apps. Missing keys can just happen in our setup.
Yes but I don't know which key is going to be missing and don't want to override Thanks! |
Hi! As @PeterAlfredLee mentioned, you can just add the key to
In the above condition case, the problem can be solved by modifying the code in the |
Reporting a bug?
Hello, recently with my team we decided to optimize vue-i18n following your guide recommendations and ended up using the official vite plugin.
Now we run into an issue with runtimeOnly build where missing message key are making the app crash, despite
formatFallback: true
because it tries to compile the fallback message key as a string.Expected behavior
with
formatFallback: true
I expect that missing message keys are not hard failing.That is a show stopper for use since our translation process is asynchronous and missing translations are common. For now, we are still including the message compiler in our build only because of this issue.
A possible fix would be to convert
key: string
to() => key
ifformatFallback && !messageCompiler
Reproduction
https://github.com/AlexandreBonaventure/vue-i18n-runtime-only
System Info
Screenshot
Additional context
Thanks!
Validations
The text was updated successfully, but these errors were encountered: