-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support paraglide i18n routing #24
Comments
Hi Loris, Thanks for writing. (Context: I still need to read up on Paraglide, but want to respond to help advance the thinking on this too.)
Yeah, this is the crux to overcome, especially given paraglide allows changing path text per language. I agree that doing more within hooks seems necessary in a
On the right track, but needs a bit more data:
Questions:
Those are my initial thoughts. Thanks again for writing. |
Paraglide doesn't need the params just the resolved path would be fine, but I can imagine that other i18n solutions will want the
Yes, Paraglide adds
I'm not sure I understand the need for this. My suggested hook would map a
If it's easier for you we can return fully formed paths for all routes. That being said, |
To be sure we're on the same page:
See the quote. SuperSitemap needs the opportunity to do further processing on all paths associated with a given route, to add data like __ If But since we need paths for all routes, and only Paraglide knows the routing logic in this world, wouldn't it be best to have a function like When only Paraglide can be aware of its routing logic, it also needs to take care of param replacement too to generate the paths for the sitemap.
Let's revisit this to decide later.
It exists, afaik, because of Google's suggestion for how to handle alternate language versions of a page, which there are two ways that are equally valid for Google, see the link. But let's come back to this later. This sounds likely to get to get extremely complex |
It will certainly add complexity, but hopefully not too much. When I'll try my best to answer your questions:
The implementation for the hook could be provided by Paraglide, yes, but
Paraglide does support Params in translated paths, but all languages must have the same set of params. Otherwise params would get lost in translation (imagine switching from a language with two params to a language with one, and the back. That just doesn't work).
Currently no
I like this suggestion much more than
Sounds good Thanks for all the careful thought you clearly put into this, this library is incredibly valuable for the Svelte community. Let's find the best solution here! |
Is there any update on this? |
The update: The reality that this will require a major rewrite of super-sitemap despite any assertions to the contrary (b/c it is currently based on Vite's But that said, if anyone feels it can be done easily, and has looked through super-sitemap's code to support this and are willing to code it, I'm very open to receiving an RFC to discuss and PR with implementation! |
Hey! Given that Paraglide is now a part of the official addons for Svelte (can be added using the |
Hi @fell-lucas If you're willing to PR a branch with the tests passing, I'm very happy to merge to a
(Alternatively, if we get programmatic route collection in SvelteKit, I'll rewrite to use that and anticipate it would become much easier to integrate any varying i18n implementations.) <- Update to add emphasis: I think this is the real enabler, that would both simplify code and add flexibility. I really hope to see this functionality offered in SvelteKit. I simply don't have time to risk spinning wheels on implementing it otherwise. Please consider contributing back by PR'ing a |
Hi, Paraglide Maintainer here
We recently released
@inlang/paraglide-js-adapter-sveltekit
(docs) which enables some very powerful i18n routing. As pointed out in #22, some of the features / design choices throw some curveballs forsuper-sitemap
. Namely:[[lang]]
parameter in theroutes
With this, it's no longer possible to determine all routes based purely on the filesystem.
This problem isn't exclusive to Paraglide. With the new
reroute
hook added in SvelteKit 2.3 any route could get rendered from any path. In order to provide a Sitemap here, users will need a config point / hook where they can generate all possible URLs that point to a given route + params.i18n routing is a special case of that, since you don't only need the path, but also the language of the page. The route mapping from
(routeId, params) => ({ href, hreflang })[]
, can easily be implemented in userland. What would be needed fromsuper-sitemap
is a hook / config point where that mapping can be used.Perhaps something like a
i18n.getAlternateLinks: (routeId, params) => ({ href, hreflang })[]
function could work?The text was updated successfully, but these errors were encountered: