ckastbjerg / next-type-safe-routes

Never should your users experience broken links again!
MIT License
70 stars 5 forks source link

Internationalized path-based URL support #29

Closed osdiab closed 2 years ago

osdiab commented 3 years ago

URL paths can have an internationalized prefix. In the case of domain-based i18n, it's irrelevant though.

One option is just not to support this in the library and make it a concern of the user—I think that might make sense, since next/link supports the locale prop anyway and anyone can make a wrapper component around links if they want to do that prepending themselves; maybe we don't do anything or maybe we provide some way to at least have a type-safe enumeration of the configured locales.

osdiab commented 2 years ago

I actually am thinking this would be useful for me for a particular use case where I want to bust a stale-while-revalidate cache by hitting a localized endpoint. i'll probably add this!

osdiab commented 2 years ago

I ended up doing it without this, on second thought probably not worth it since it's easy enough to just concat the path yourself. canceling