Hello is there a way how to use this library in VUE.js application?
Thank you
I have tried it in VUE application. Followed manual part how to use it in javascript application.
Included @lingui/core and all cli libs from manual.
But I faced these issues:
- npm run extract > processeed only *.js files, *.vue files was ignored
- npm run serve > log is full of error like invalid or not found module and so on...
As long Vue SFC files are not a valid javascript, linguijs built-in extractor could not parse and extract messages from them. However, thanks to extendable lingui architecture, it's possible to write custom extractors which would transpile your
*.vuefiles to the plain old-fashioned Javascript.The concept is similar to loaders in webpack.
There is an ongoing work on creating Vue extractor as official LinguiJS package here
Regarding
npm run serveit's most likely because you're trying to use@lingui/macropackage where babel-plugin-macros is not enabled in your build pipeline.Note that
vite-plugin-babel-macrosis not supporting*.vuefiles, that might be a root cause of the problem.To learn more about integrating LinguiJS with Vue and Vite, you can refer to this issue for more information and potential solutions.