Open samuelstroschein opened 3 months ago
Curious what @loris.sigrist thinks about it
I try to keep the meta-framework APIs similar by reusing concepts that work in one in as many as I can. The RoutingStrategy
interface is really promising & portable for example.
However, basically everything needs to interact with framework code in some way. Even RoutingStrategy
relies on being able to access the Framework's Request
object.
IMO most of the framework code would be quite difficult to centralize, however, we can certainly align the concepts more. Paraglide-SvelteKit should have a RoutingStrategy
interface as well
@LorisSigrist However, basically everything needs to interact with framework code in some way.
Implementation would be up to the adapters. For knowledge transfer, the only important part is the API. Agree/disagree?
I can try to come up with a unified API that works in all our adapters, however, I'm not sure it'll end up being simpler, as the adapters will likely end up with way more primitives to implement.
TBH I would need to try before I can give a confident assessment here
Makes sense. Let's delay the discussion und push out importer/exporter + variants
For future discussions:
Moving the vite plugin to paraglide js also seems to make sense.
paraglide-vite
, and paraglide-sveltekit
in the dependencies. Prob because they were confused. Maybe an "adapter" architecture was/is better for communication and ease of use
With the spin that everyone installs paraglide-js
and an adapter "hooks" into the compiler instead of providing their own compiler.
paraglide-js compile --adapter @inlang/paraglide-js-sveltekit-adapter
import defineConfig from "vite"
import { vitePlugin as paraglide } from "@inlang/paraglide-js"
import svelteKitAdapter from "@inlang/paraglide-js-sveltekit-adapter"
export default defineConfig({
plugins: [
paraglide({ adapter: svelteKitAdapter })
]
})
(No action required, just adding context)
Another reason for "going back to adapters" is branding. Users are referring to Paraglide JS as Paraglide JS. I found myself being confused too when I give recommendations, wondering if I should say "use Paraglide Svelte|React|Next|SvelteKit|Astro|X". Saying just "use Paraglide JS (with your frameworks adapter)" would be much simpler.
*Screenshot is taken from *https://www.reddit.com/r/nextjs/comments/1etryqn/i18n_with_app_router/
Independent upgrading of paragide js and the metaframework implementation is another reason to go back to adapters.
Releasing paraglide 2.0 with variant supports needs to update all metaframework versions. It would be (much!) easier if Paraglide JS can be upgraded independently of the adapters.
Context
I find it hard to give recommendations/support on paraglide for different metaframeowkrs because they have different APIs.
Proposal
Move metaframework-related APIs like routing strategy into paraglide-js for a consistent way/knowledge transfer between metaframework.
Additional information
Came up in https://discord.com/channels/897438559458430986/1271469453149732995/1271491605077037097