Svelte + Meteor + i18n

Which i18n library do you suggest to use it with Svelte + Meteor?

1 Like

I would just use https://www.npmjs.com/package/svelte-i18n, which seems to be the most popular i18n solution for Svelte — I’m about to implement it into my application, I’ll post back if I end up being dissatisfied with it.

2 Likes

Nice! I’ll have a look.

Just curious to know if this package can manage even server-side translations.

Let me know.
Thanks :slight_smile:

1 Like

Hi rdb, have you had luck using this package? I am trying to implement i18n in my meteor svelte app, but svelte-i18n is not yet showing translations (I can just see the keys without any translation) and meteor-universe-i18n is throwing an error when trying to change the locale.

Hi @tosi, can you share what error you got?

Hi, I gave up on svelte-i18n and am using universe-i18n. I posted my working code into slack/svelte. The only problem pending at the moment is how to save/load translations for user defined content in the database. I used to use tap:i18n that supports that out of the box.

Hi @tosi, I created an exemplary svelte project with universe:i18n and database integration. The general idea is to keep a timestamp in the database on when a given translation was last updated and load new translations only when this timestamp differs on the client. This is a very basic example (I guess the code could be a bit cleaner) but I hope this will help you.

1 Like

Thank you @zendranm , I will use it as an inspiration as users would like to update translations at times and doing it in json/yaml is not very convenient. So I can imagine a switch on the page for in-place editing of the keys that would make all the strings editable.

What I needed originally was a solution for storing translatable user content, like their own products. So I ended up doing it like productName: { en: 'Car', es: 'Carro' } and having a function similar to $t for displaying data in the right language.

So far I am quite happy with universe:i18n. It just doesn’t support pluralization. And btw using VS Code’s Ally i18n package was a total game changer for me. Managing translations with that is a breeze. It will break once the translations are loaded to the database though (unless they are synced back to JSON).