sveltekit-i18n/lib

component library

genvlad opened this issue · 0 comments

Hello, I would like to ask you for some hints, because i dont know how to solve it.

I have two project based on svelte kit:

ui-components - selft stand, independent component library which is bild as library not app

my-application - application with pages, routes, layouts and so on, it has dependency to ui-components

In both project I use https://github.com/sveltekit-i18n/lib for app translation.

Now let imagine this case, for example. In ui-components I have SaveButton.svelte component. Which is simple component with icon, label and some tailwind css classes. ui-components contains localisation files en.json and de.json, with localised key "save" which is used as name of this buuton. In ui-components is implemented also one page.svelte which show all components contained in this library. But this page is only for develop purpose and is not exported to dist folder and this demo page using default en locale.

my-application contains several pages with also ssr. it has implemented own sveltekit-i18n with custom localisation files en.json and de.json. But it also using components from component library ui-components. in header user can select locale of app, and after that app is switch to correct translation.

Problem: I dont know how to deal with it that ui-components and my-application has own translations. How to connect selected locale from my application to ui-components. How to handle change. I would like to have custom translation files for components included in ui-component library, but I would like to reflect to locale which is selected in owned app.

I hope that is clear. If not please let me know. Thank you very much for each help.