You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using locale files on ".ts" format (can be .js not only .ts) and i would love it to work.
Why? Because i have enums in all my application and have the key centralized por easy change and consistency.
Now is throwing error, of course:
Uncaught (in promise) SyntaxError: Unexpected returntypein composer (at message-compiler.esm-bundler.js:54:19)
at createCompileError (message-compiler.esm-bundler.js:54:19)
at createI18nError (vue-i18n.runtime.esm-bundler.js:100:12)
at wrapWithDeps (vue-i18n.runtime.esm-bundler.js:545:19)
at Object.transrateVNode (vue-i18n.runtime.esm-bundler.js:582:16)
at Proxy.<anonymous> (vue-i18n.runtime.esm-bundler.js:1326:35)
at renderComponentRoot (runtime-core.esm-bundler.js:914:44)
at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js:5649:57)
at ReactiveEffect.run (reactivity.esm-bundler.js:190:25)
at instance.update (runtime-core.esm-bundler.js:5763:56)
at setupRenderEffect (runtime-core.esm-bundler.js:5777:9)
Suggested solution
Support .ts/.js files with "export default" locales/en-US.ts
import { MyEnum } from '@/enums'export default {
enums: {
[MyEnum.first]: 'I am the text of enum first',
[MyEnum.second]: 'I am the text of enum second',
},
}
Alternative
The alternative would be to inject at VueI18nPlugin the locale/messages vite.config.js
Clear and concise description of the problem
I am using locale files on ".ts" format (can be .js not only .ts) and i would love it to work.
Why? Because i have enums in all my application and have the key centralized por easy change and consistency.
Now is throwing error, of course:
Suggested solution
Support .ts/.js files with "export default"
locales/en-US.ts
Alternative
The alternative would be to inject at VueI18nPlugin the locale/messages
vite.config.js
VueI18nPlugin({ include: resolve(__dirname, './src/locales/**'), runtimeOnly: true, }),
vite.config.js
Additional context
This allows static keys to be persistent from source, the locale files.
If you change enum, all continue to work without more changes
Validations
The text was updated successfully, but these errors were encountered: