You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the loader function can not load translations dynamically, passing the current route or even parameters would allow for better usage.
My example use case would by I have and article that is located under article/[articleId], so once the user navigates to the article the translation for that article only should be loaded. I can do this by loading the correct translation from my DB in the +page.server.ts but doing it directly trough the translation library would be cleaner.
The current loader function is export type T = () => Promise<Translations.Input>;. A simple solution would just be to pass the current route to the loader like export type T = (route: string) => Promise<Translations.Input>;.
A more advanced version would be to allow parameters in the routes for a loader, similar to how sveltekit params work.
So for example defining the routes as /article/{articleId} (or article/[articleId]) and the loader as export type T = (params: {[key: string]: string}) => Promise<Translations.Input>; it would then pass
{
"articleId": "some_id"
}
to the loader function.
The text was updated successfully, but these errors were encountered:
Currently the loader function can not load translations dynamically, passing the current route or even parameters would allow for better usage.
My example use case would by I have and article that is located under
article/[articleId]
, so once the user navigates to the article the translation for that article only should be loaded. I can do this by loading the correct translation from my DB in the+page.server.ts
but doing it directly trough the translation library would be cleaner.The current loader function is
export type T = () => Promise<Translations.Input>;
. A simple solution would just be to pass the current route to the loader likeexport type T = (route: string) => Promise<Translations.Input>;
.A more advanced version would be to allow parameters in the
routes
for a loader, similar to how sveltekitparams
work.So for example defining the routes as
/article/{articleId}
(orarticle/[articleId]
) and the loader asexport type T = (params: {[key: string]: string}) => Promise<Translations.Input>;
it would then passto the loader function.
The text was updated successfully, but these errors were encountered: