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

feat(nextjs): check for '[lang]' folder structure when creating example page #605

Closed
wants to merge 1 commit into from

Conversation

HaraldNordgren
Copy link
Contributor

@HaraldNordgren HaraldNordgren commented Jun 23, 2024

Currently, for my project where pages are placed in src/app/[lang], it will place the example page in the wrong place and it has to be manually moved.

@HaraldNordgren HaraldNordgren marked this pull request as ready for review June 23, 2024 16:55
@HaraldNordgren HaraldNordgren force-pushed the app_lang branch 7 times, most recently from 859a8ba to f2fe5a9 Compare June 23, 2024 18:20
@HaraldNordgren
Copy link
Contributor Author

Ping @AbhiPrasad

@AbhiPrasad AbhiPrasad requested review from lforst and AbhiPrasad June 25, 2024 16:08
@AbhiPrasad
Copy link
Member

Thank you for the PR @HaraldNordgren! I put this on my todo to review

@lforst
Copy link
Member

lforst commented Jul 1, 2024

Hi, thanks for the PR but we will likely not go through with it because [lang] is not a convention.

Is there a specific reason why the page doesn't work for you directly in app/src?

@HaraldNordgren
Copy link
Contributor Author

Hi @lforst

Are you sure it's not a convention? It's mentioned here as the way to do internationalization: https://nextjs.org/docs/app/building-your-application/routing/internationalization#routing-overview

@lforst
Copy link
Member

lforst commented Jul 1, 2024

The way I read the docs you shared, it is not a convention: https://nextjs.org/docs/app/building-your-application/routing/internationalization#routing-overview:~:text=Changing%20displayed%20content%20based%20on%20the%20user%E2%80%99s%20preferred%20locale%2C%20or%20localization%2C%20is%20not%20something%20specific%20to%20Next.js

Next.js has no built-in way to do this. Everything you do with regard to localization is userland code.

This question still stands 🤔:

Is there a specific reason why the page doesn't work for you directly in app/src?

@HaraldNordgren
Copy link
Contributor Author

HaraldNordgren commented Jul 1, 2024

It fails like this if I don't move the example page into the [lang] folder:

$ npm run build

> [email protected] build
> next build

- info Loaded env from /Users/Harald/dd/hava-web/.env.production
- warn You have enabled experimental features (instrumentationHook, outputFileTracingExcludes) in next.config.js.
- warn Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.

- error sentry-example-page/page.tsx doesn't have a root layout. To fix this error, make sure every page has a root layout.
- info Creating an optimized production build .

@lforst
Copy link
Member

lforst commented Jul 1, 2024

Okay, now I understand. Thanks! This we need to solve differently and more generically than this PR. I created an issue to track this: #607

Thanks for helping out!

@lforst lforst closed this Jul 1, 2024
@HaraldNordgren
Copy link
Contributor Author

HaraldNordgren commented Jul 6, 2024

Fair enough @lforst, I put up my refactoring as its own PR if it's of any interest: #609.

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.

3 participants