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

Ability to change X-NEXT-INTL-LOCALE header name #780

Closed
marcincodes opened this issue Jan 16, 2024 · 3 comments
Closed

Ability to change X-NEXT-INTL-LOCALE header name #780

marcincodes opened this issue Jan 16, 2024 · 3 comments
Labels
enhancement New feature or request unconfirmed Needs triage.

Comments

@marcincodes
Copy link

Is your feature request related to a problem? Please describe.

In my application I'm already using using header to pass local between server and client. It's called x-locale and it's exactly the same as X-NEXT-INTL-LOCALE. But right now I need to pass both headers.

I'm happy to help contribute this feature and submit PR if you are willing to approve such feature

Describe the solution you'd like

Add ability to change header name in next.config similar as we are changing path to i18n file

Describe alternatives you've considered

Add both x-locale and X-NEXT-INTL-LOCALE header

@marcincodes marcincodes added enhancement New feature or request unconfirmed Needs triage. labels Jan 16, 2024
@amannn
Copy link
Owner

amannn commented Jan 17, 2024

Thank you for offering your help for contribution @marcincodes!

In my application I'm already using using header to pass local between server and client

x-next-intl-locale is meant as a workaround for passing the locale between the middleware and React Server Components (some more on this in the static rendering section in the docs).

What is your use case for providing the x-locale header? Note that you can compose the middleware to read from a custom header to assign e.g. the defaultLocale dynamically.

x-next-intl-locale is really a workaround that is currently necessary and I hope to remove it eventually. Therefore, I'm not looking for configuration options in regard to this—I hope you can understand!

@marcincodes
Copy link
Author

We are using x-locale to communicate user locale to backend and setup translation in on server side.

If that's a workaround and long term goal is to get rid of it I fully understand you don't want to make such configuration.

Thanks for your response and for your work on next-intl!

@amannn
Copy link
Owner

amannn commented Jan 19, 2024

I see! Thanks, I'll close this for the time being then as long as there's a way for you to integrate with your custom header.

@amannn amannn closed this as completed Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request unconfirmed Needs triage.
Projects
None yet
Development

No branches or pull requests

2 participants