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
Getting 'Cannot read properties of undefined (reading 't')' error in core-base.mjs::formatParts #1805
Comments
Thank you for your feadback! More infoWhy do I need to provide a reproduction?Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making. What will happen?If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritise it based on its severity and how many people we think it might affect. If How can I create a reproduction?We have a couple of templates for starting with a minimal reproduction: 👉 Reproduction mininal starter A public GitHub repository is also perfect. 👌 Please ensure that the reproduction is as minimal as possible. You might also find these other articles interesting and/or helpful: |
@kazupon While working on minimal production I find wierd thing. The message compiler registration is different between // vue-i18n.mjs
// register message compiler at vue-i18n
if (__INTLIFY_JIT_COMPILATION__) {
registerMessageCompiler(compile);
}
else {
registerMessageCompiler(compileToFunction);
}
// vue-i18n.cjs
// register message compiler at vue-i18n
{
coreBase.registerMessageCompiler(coreBase.compile);
} In my minimal reproduction project the mjs file is invoked, and run Shouldn't the code be same in mjs and cjs? Does the cjs lack the Reproduction |
Thank you for your reporting! I think that you don't setup your project uses Vue CLI, this documentation will be helpful. |
Reporting a bug?
After upgrading vue-i18n from 9.2.2 to 9.10.1, and run my application in production mode, I get error while calling i18n.t API as below.
For now, I locating the difference between the scenario is in the function messageCompiler in core-base.mjs.
Before upgrading
messageCompiler
returnsnew Function(`return ${code}`)()
which directly returns my translated message (which is a plain string)After upgrading, dev mode
messageCompiler
returns() => message
which also returns translated message directlyAfter upgrading, production mode
messageCompiler
returnsformat(message)
which leads to(ctx) => formatParts(ctx, ast)
. And when formatParts is invoked, the parameterast
is just my message string, which cause the error report.Is this the expected behavior? Or should I do some other configuration to allow my plain text is properly translated?
Expected behavior
No error occurs
Reproduction
Still trying. No nuxt, no SSR in my case
System Info
Screenshot
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: