string interpolations in i18n do not work in compiled mode #15391
Labels
area/plugins
bug/0-needs-info
Need more info to reproduce
flavour/quasar-cli-vite
kind/bug 🐞
Qv2 🔝
Quasar v2 issues
What happened?
Plugin:
internationalization (the plugin proposed by quasar when initializing a new project)
This plugin allows you to use string interpolation to output text as follows:
i18n/en/index.ts
i18n/fr/index.ts
Which you can then call as per the docs here
https://kazupon.github.io/vue-i18n/guide/formatting.html#list-formatting
Like this:
{{ $t('messages.greeting', ['Dave']) }}
When running in dev (HMR) mode, everything works fine
However once you build the project, the string replacements don't work anymore
It does actually switch between the languages, but the interpolation is broken in the final compiled version
Current result:
Hello {0}
&Bonjour {0}
Expected result:
Hello Dave
&Bonjour Dave
What did you expect to happen?
Expected for this to work the same in build mode as in dev mode.
Submitting here, as this might be related to something in the way quasar builds the output, maybe a reference missing...
I did get a message on build saying that i18n had a unmet dependency with vite@2.0.0, but adding it to the dev dependencies just made the error message go away, but not the actual problem
Reproduction URL
https://stackblitz.com/edit/quasarframework-webncp
How to reproduce?
Could not set up a stackblitz example because
I pasted everything as it was setup via the quasar command line locally, but just wont work
The problem is you cannot create a quasar project via the command line in stackblitz apparently, just able to use the forked version
My version was configured automatically locally via the
yarn create quasar
wizardFlavour
Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)
Areas
Plugins (quasar)
Platforms/Browsers
Other
Quasar info output
Relevant log output
No response
Additional context
does not work on stackblitz, as path does not work in quasar.config.js
This also is broken on stackblitz.
This code is what was generated by the quasar wizard in boot/i18n.ts
import messages from 'src/i18n';
The text was updated successfully, but these errors were encountered: