woutdp / live_svelte

Svelte inside Phoenix LiveView with seamless end-to-end reactivity
https://hexdocs.pm/live_svelte
MIT License
1.01k stars 37 forks source link

I18N Support #120

Open garlandcrow opened 2 months ago

garlandcrow commented 2 months ago

Just curious if there is any ideas for how to support this now or in the future. Maybe we do something like how "live" is injected as a common prop to all components? We could inject a KV map that we populate from gettext, and then use that for the translations? Of course if a project 100% is svelte only then there are JS solutions for this but if we mix and match liveview and livesvelte, best way would be to reuse the same thing. Any other ideas one a first go at this?

woutdp commented 2 months ago

Hmm interesting I haven't thought about I18N support. Not sure if it's the correct thing to support too. If we go with this it should be a more generalizable solution that is not specific to I18N.

Something like a default prop that you don't have to pass explicitely, but define in one location, and is always available. A solution like that makes the most sense to me