Replies: 1 comment
-
For now, I write it like this, though I wonder if there might be a better method.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to use Language Middleware #3785 to achieve the following:
Accessing
/home
, the default language is EnglishAccessing
/ja/home
, the language switches to Japanese.According to the documentation
/ja/home
workshttps://hono.dev/docs/middleware/builtin/language#path-based-routing
but how to make the
:lang
optional and fallback to thefallbackLanguage
?Do I have to write it twice?
app.get('/home', ...)
andapp.get('/:lang/home', ...)
since
app.get('/:lang?/home')
didn't works.Beta Was this translation helpful? Give feedback.
All reactions