Skip to content
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

Using Meteor Vite with i18n #37

Open
juliandierker opened this issue Jun 12, 2023 · 1 comment
Open

Using Meteor Vite with i18n #37

juliandierker opened this issue Jun 12, 2023 · 1 comment

Comments

@juliandierker
Copy link

juliandierker commented Jun 12, 2023

Hey. I am still interested in switching to vite. I am concernded a little bit about the i18n behavior since we use
meteor i18n universe for our translation files. Is there any way in the vite config I can tell vite to use the meteor i18n package and also to use the given folder structure from my i18n files?

@timsun28
Copy link

timsun28 commented Aug 2, 2024

Hi,

I've recently updated my meteor project to 3.0, including moving to vite bundler. (using this fork) and also ran into the same issue you are having.

From what I could find this might have something to do how vite parses json files directly and also splits it. When I looked at the sources tab in chrome I found that it exported all my top level keys separately.

I am not very experience with vite and how this works, but I found a solution that works as follows:

import english from "/imports/i18n/en.i18n.json";
i18n.addTranslations("en", english);

The english variable contained a js object with all my keys and translations that I was able to add like this instead of importing just the .json file

I hope this might help you and if you're still having issues let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants