Replies: 4 comments 25 replies
-
Here are hopefully some good links: |
Beta Was this translation helpful? Give feedback.
-
I'm not very familiar with Vue, so i could not help on the best solution in that ecosystem. You already can use just To replicate JSX macro in Vue templates you need to somehow hook into the Vue compiler, and as far as i understand it's not something very popular and doable. So the easiest way would be just pass strings created using macro from setup script to template. |
Beta Was this translation helpful? Give feedback.
-
Following the discussion above, we now are sure, as of today, using vue@3 + vite + lingui & extractor & vite plugin, it is possible to:
The goal would be to improve the DX inside the template part and for that I think it is doable to plug into the lingui extractor for vue between the vue parser and the vue compiler in order to update the template AST. Going from <template>
<Trans>Hi, I am a <b>statement</b> withing my {{ name }} template</Trans>
</template> to <template>
{{ i18n._({id: "XXXX", message: "Hi, I am a <0>statement</0> withing my {name} template", comments: "", context: ""}) }}
</template> I still need to found in vue how the descriptor can be updated if and when the AST is changed Next step would be to reuse part of that logic to transform the template via vite to produce a real Trans component code with slots for children. |
Beta Was this translation helpful? Give feedback.
-
After several months away from this project I'm back and I have a thing working for vue template. It is not complete, it is a start with the How I did it: I wrote an extractor based on the actual lingui vue extractor but with a nodeTransforms for the SFC compilerTemplate part and another transformer for the same SFC template compilerOptions for the vite vue plugin (but can easily be used anywhere I think). Both transformers have a lot of code in common obviously. How it works ?
What still need to be done?
|
Beta Was this translation helpful? Give feedback.
-
I'm starting to work with Vue, coming from the React world, and I really want to keep using lingui because I think it is the best frontend solution for handling i18n issues.
Lingui + Vue + Vite works with the basics, as a JS project, so atm you do not have some features like :
In fact every goodies that make Lingui having a very good DX.
I want to make this happen, but I need the help of Vue & Lingui masters here.
Who's on board?
Beta Was this translation helpful? Give feedback.
All reactions