Skip to content

Commit

Permalink
Merge pull request #2752 from muhammedaksam/main
Browse files Browse the repository at this point in the history
Changed localeCookeValue to localeCookieValue.
  • Loading branch information
LorisSigrist authored May 13, 2024
2 parents 33e79f8 + 4cb3581 commit c55dfb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { LANG_COOKIE } from "../../constants"
export const createCookieDetection =
<T extends string>(cfg: { availableLanguageTags: readonly T[] }): LanguageDetector<T> =>
(request) => {
const localeCookeValue = request.cookies.get(LANG_COOKIE.name)?.value
if (cfg.availableLanguageTags.includes(localeCookeValue as T)) return localeCookeValue as T
const localeCookieValue = request.cookies.get(LANG_COOKIE.name)?.value
if (cfg.availableLanguageTags.includes(localeCookieValue as T)) return localeCookieValue as T
else return undefined
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function Middleware<T extends string>(opt: MiddlewareOptions<T>) {
* https://nextjs.org/docs/pages/building-your-application/routing/middleware#setting-headers
*/
return function middleware(request: NextRequest) {
const localeCookeValue = request.cookies.get(LANG_COOKIE.name)?.value
const localeCookieValue = request.cookies.get(LANG_COOKIE.name)?.value
const locale = resolveLanguage(request, sourceLanguageTag, [
opt.strategy.resolveLocale,
createCookieDetection({ availableLanguageTags: availableLanguageTags }),
Expand All @@ -64,7 +64,7 @@ export function Middleware<T extends string>(opt: MiddlewareOptions<T>) {
const localisedURL = opt.strategy.getLocalisedUrl(canonicalPath, locale, false)

const localeCookieMatches =
isAvailableLanguageTag(localeCookeValue) && localeCookeValue === locale
isAvailableLanguageTag(localeCookieValue) && localeCookieValue === locale

const headers = new Headers(request.headers)
headers.set(PARAGLIDE_LANGUAGE_HEADER_NAME, locale)
Expand Down

0 comments on commit c55dfb2

Please sign in to comment.