Skip to content
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

docs: Adapt examples for rootParams #1619

Open
wants to merge 16 commits into
base: v4
Choose a base branch
from
Open

docs: Adapt examples for rootParams #1619

wants to merge 16 commits into from

Conversation

amannn
Copy link
Owner

@amannn amannn commented Dec 18, 2024

Based on #1625

TODO

  • Docs?
    • Getting started
    • getTranslations({locale}). Update async docs in general?
    • i18n/request.ts
  • Get 404 page at /unknown working again when Next.js allows this
  • rootParams don't support Route Handlers (breaks a test of the playground)

Copy link

vercel bot commented Dec 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-intl-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 28, 2025 11:44am
next-intl-example-app-router ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 28, 2025 11:44am
next-intl-example-app-router-without-i18n-routing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 28, 2025 11:44am

@@ -12,7 +12,7 @@
},
"dependencies": {
"clsx": "^2.1.1",
"next": "^14.2.4",
"next": "15.1.1-canary.12",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Revert once in stable

};

export default async function BaseLayout({children, locale}: Props) {
// Inline?
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Depends on whether a global not found page can be styled

it('renders', () => {
// Disabled until canary version is reverted
// eslint-disable-next-line jest/no-disabled-tests
it.skip('renders', () => {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Should be resolved once we use the same version across packages and examples

export default getRequestConfig(async () => {
const params = await rootParams();
const locale = hasLocale(routing.locales, params.locale)
? params.locale
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -7,7 +7,7 @@ import type {Locale} from './AppConfig.tsx';
*/
export default function hasLocale<LocaleType extends Locale>(
locales: ReadonlyArray<LocaleType>,
candidate?: string | null
candidate: unknown
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A param can be string[]

@amannn amannn changed the base branch from v4 to feat/support-rootparams December 19, 2024 11:10
@amannn amannn changed the title feat: Adopt rootParams docs: Adopt examples for rootParams Dec 19, 2024
@amannn amannn changed the title docs: Adopt examples for rootParams docs: Adapt examples for rootParams Dec 19, 2024
@amannn amannn changed the base branch from feat/support-rootparams to v4 February 28, 2025 10:46
# Conflicts:
#	examples/example-app-router-playground/package.json
#	examples/example-app-router-playground/src/app/[locale]/about/page.tsx
#	examples/example-app-router-playground/src/app/[locale]/api/route.ts
#	examples/example-app-router-playground/src/app/[locale]/layout.tsx
#	examples/example-app-router-playground/src/app/[locale]/news/[articleId]/page.tsx
#	examples/example-app-router-playground/src/app/[locale]/page.tsx
#	examples/example-app-router-playground/src/i18n/request.tsx
#	examples/example-app-router/package.json
#	examples/example-app-router/src/app/[locale]/layout.tsx
#	examples/example-app-router/src/app/[locale]/page.tsx
#	examples/example-app-router/src/app/[locale]/pathnames/page.tsx
#	examples/example-app-router/src/app/not-found.tsx
#	examples/example-app-router/src/components/BaseLayout.tsx
#	packages/use-intl/src/core/hasLocale.test.tsx
#	pnpm-lock.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant