Export the resolveLocale
functions for use in the getRequestConfig
no routing locale resolution
#1426
Labels
resolveLocale
functions for use in the getRequestConfig
no routing locale resolution
#1426
Is your feature request related to a problem? Please describe.
I am working on an internal app that does not require having the locale in the URL. Therefore I opted for the without i18n routing variant of the next-intl use. According to the documentation the locale resolution should happen in the
i18n/request.ts
using thegetRequestConfig
function.All I want to do here is to do the same locale resolution as what the routing variant does, only skip the first route resolution. I want to check the
NEXT_LOCALE
cookie, read theaccept-language
header if it is not present and fallback to the default locale when nothing else matched. But all that logic already exists in resolveLocale. It seems unreasonable that I have to reimplement a piece of logic the library already has just to pass it back to it.Describe the solution you'd like
Honestly the best solution would be something similar to what was proposed in #1369, where I could simply omit the
detectFromUrl
piece from the locale resolution chain and let the library do its work.If for any reason you would not want to make it too complex, just exporting the
getAcceptLanguageLocale
andgetLocaleFromCookie
helper functions for use in thegetRequestConfig
function might be enough.Describe alternatives you've considered
An alternative is already described in the docs:
Yes, it is doable, but as I wrote above, it seems awkward to have to reimplement some logic that is already there.
Thank you for considering this issue.
The text was updated successfully, but these errors were encountered: