suggestion: router/next middleware to autolink by lang variable
See original GitHub issueHello, I use localeSubpaths with import { Link } from '../config/i18n'
and it works really well.
When I need to use push('/url')
from react/router
, I need to set subpath every time according to locale variable, I would prefer approach of importing {Router} from '../config/i18n'
which would be middleware for standard next router that would be prefixing urls automatically with locale as
I18nRouter.push('/media')
// to
I18nRouter.push('/en/media')
// or
I18nRouter.push('/media') // if default locale
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (6 by maintainers)
Top Results From Across the Web
withI18nRouter HOC for locale subpath routing #4 - GitHub
withI18nRouter HOC for locale subpath routing #4 ... suggestion: router/next middleware to autolink by lang variable #143.
Read more >Advanced Features: Internationalized Routing - Next.js
Next.js has built-in support for internationalized (i18n) routing since v10.0.0 . You can provide a list of locales, the default locale, and domain-specific ......
Read more >Advanced internationalization with Next.js and middleware
Next.js 12 introduced middleware for handling logic at the CDN level ... Update the router and locale if the selected language is changed....
Read more >The MERN stack tutorial - LogRocket Blog
Learn all about the MERN stack in this step-by-step guide on how to use it by developing a simple CRUD application from scratch....
Read more >Altered map routes based on user profile information
Methods and systems for an improved navigation environment are provided. The navigation system can route users to preferred locations based on user profile ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I like this suggestion. Though I could conceptually think about how this would work, I want to make sure that I fully understand the “ins and outs” of Next.Router before doing so. We would also probably need to provide a wrapper for the
withRouter
HoC.Probably all that will happen prior to a 1.0 release is that we expose lang path utils so that “advanced” users can import them and use them for their own imperative routing.
There’s a lot going on in this package at the moment and I don’t want to commit to any new features/API changes prior to 1.0.
@capellini Do you agree?