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

middleware: expose function to retrieve locale. #515

Closed
fernandojbf opened this issue Sep 20, 2023 · 1 comment
Closed

middleware: expose function to retrieve locale. #515

fernandojbf opened this issue Sep 20, 2023 · 1 comment
Labels
enhancement New feature or request unconfirmed Needs triage.

Comments

@fernandojbf
Copy link

fernandojbf commented Sep 20, 2023

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

I want to have a way to pass a header to my applications with the locale.

To make this possible, i need to make sure I have the request.header set before building the response via handleI18nRouting.

Would be nice to have the same function that handleI18nRouting to retrieve the locale. this will make sure that handleI18nRouting and the locale predefined before would be target as the same value.

Adding this as discussion. Would this make sense?

Describe the solution you'd like

Maybe:

const locale = getResolveLocale(config, request)
const request.headers.set('x..', locale);
const response = handleI18nRouting(request);

Describe alternatives you've considered

Can be other api. the idea is to have a way of getting the locale before we generate the response

@fernandojbf fernandojbf added enhancement New feature or request unconfirmed Needs triage. labels Sep 20, 2023
@fernandojbf
Copy link
Author

It seems that the middleware already sets the locale via HEADER_LOCALE_NAME.

I do not require the feature anymore since is already injected in the headers.

Thanks

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

1 participant