-
-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add defineRouting
for easier i18n routing setup
#1294
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This reverts commit 47239f9.
…currently active pathname for localized pathnames
# Conflicts: # packages/next-intl/src/middleware/utils.test.tsx # packages/next-intl/src/shared/utils.test.tsx
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
amannn
commented
Aug 27, 2024
├── i18n.ts (3) | ||
├── i18n | ||
│ ├── routing.ts (3) | ||
│ └── request.ts (5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notes
which files do we have?
- i18n.ts: Request-specific configuration provided to Server Components
- plugin in next.config.js: Links i18n.ts
- navigation.ts: Creates navigation APIs
- middleware.ts: Sets up the middleware
- config.ts? constants
aspects
- i18n.ts sounds like it has everything (doesnt have routing config)
- module graphs: dont mix middleware with navigation
i18n/request.ts
i18n/navigation.ts
i18n/(config.ts)
i18n.request.ts
i18n.routing.ts
i18n.navigation.ts (export middleware in rsc, noop in browser. smhw cool, but also )
# notes
what does setup include:
- infra to provide request-specific config like messages and timezone to components
- routing: handle incoming requests, provide navigation apis
# node.js
i18n/config.json
i18n.tsx
# sentry
sentry.client.js
sentry.server.js
sentry.edge.js
# other
tailwind.config.js
relay.config.js
# next-international
locales/client.ts
locales/server.ts
# i18next
app/i18n/settings.js
intl-request-config.ts
i18n.ts
i18n.request.ts
i18n.navigation.ts
middleware.ts
next.config.js
This reverts commit 79f40c1.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
defineRouting
API that returns arouting
object that can be used to initialize the middleware as well as the navigation APIs. This provides type-safety for your i18n config with a single import and helps to ensure that your i18n config is in sync across your app.(in the docs we now suggest to create navigation APIs directly in
routing.ts
)Changes
defineRouting
APIrouting
) as second param tocreateMiddleware
src/routing.ts
instead ofsrc/navigation.ts
i18n.ts
in getting started docsTODO: