Fix for locale.split is not a function. (#5794)
* Fix for locale.split is not a function. Following from https://github.com/zeit/next.js/pull/5488 - Renamed languages to supportedLanguages - Firstly, accept languages based on supportedLanguages - And finally, accept a single language, if it returns false, the default of 'en' is used. I looked at the navigator library, which is used by 'accept', this should be a more solid solution, since we can now know that `const locale` is always a string. // Before (Sometimes returns an array as `const local`) const locale = accept.language(languages) || 'en' // After (Always returns a string) const locale = accept.language(accept.languages(supportedLanguages)) || 'en'; * Update server.js Update variable name.
Showing
Please
register
or
sign in
to comment