SvelteKit component library #699
Replies: 4 comments 3 replies
-
I don't have an example at hand.
Then somewhere in you code you can call
import { initEnLocale } from 'ui-lib'
export const load = asnyc () => {
await loadLocaleAsync('en') //
initEnLocale()
} Variant 2 is probably the better choice as it involves less manual steps for users of the ui library, but you probably need to experiment a bit. |
Beta Was this translation helpful? Give feedback.
-
Thanks. I was trying something like suggestion 2. But I wasn't sure what should go in my initEnLocale() method. I think I need a load all (for server side) and load locale for front end. I found simply trying to load the languages the usual way didn't work, but didnt have time to investigate further. A bit like this in an index.ts file for my components :
|
Beta Was this translation helpful? Give feedback.
-
@danielbayley80 did you find a workaround to your problem? |
Beta Was this translation helpful? Give feedback.
-
Yes that is what I had to do. I configure it in the UI library so I can work there , test, etc. Then I have it in the main project. I didn't notice it initialising 2 instances, although that may well be happening thinking about it. I don't know if that is a problem or not. I use typed-inject in other case so I can inject services project by project, so maybe it can be wrapped and injected. It's workable for now though so I've stuck with it. |
Beta Was this translation helpful? Give feedback.
-
I have a UI component library with its own translation files.
I also have a master project with it's translations.
What I can't work out is the best way to pull through the component library language files and ensure they are loaded.
Are there any examples for this?
Beta Was this translation helpful? Give feedback.
All reactions