opral / inlang-paraglide-js

Tree-shakable i18n library build on the inlang ecosystem.
https://inlang.com/m/gerre34r/library-inlang-paraglideJs
23 stars 0 forks source link

NextJS Adapter Typesafe Routing #75

Open LorisSigrist opened 2 months ago

LorisSigrist commented 2 months ago

Context

The Next Adapter offers i18n routing with translated paths. In order to do this the users must list out some of the pathnames that are available in the app.

It would be really nice DX if the translated navigation APIs suggested the routes that are known to be available (other values are still supported OFC).

Screenshot 2024-04-12 at 10.30.14.png

I don't see anyone else doing this, so this is a great opportunity to differentiate ourselves.

Proposal

Type the href property of the Link component and other routing APIs with a type that suggests the known paths, without enforcing them so you can still use other values.

type Href = `/about` | `/some-page` | ({} & string) | import("url").UrlObject