-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: Support for other headers, not 'accept-language' (#15)
- Loading branch information
Showing
12 changed files
with
490 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
console.log('main navigator.language', navigator.language) | ||
console.log('main navigator.languages', navigator.languages) | ||
|
||
new Worker(new URL('./worker.ts', import.meta.url).href, { type: 'module' }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { getAcceptLanguages } from 'https://esm.sh/@intlify/utils/web' | ||
import { getHeaderLanguages } from 'https://esm.sh/@intlify/utils/web' | ||
|
||
const port = 8125 | ||
Deno.serve({ | ||
port, | ||
}, (req: Request) => { | ||
const acceptLanguages = getAcceptLanguages(req) | ||
return new Response(`detect accpect-language: ${acceptLanguages}`) | ||
const languages = getHeaderLanguages(req) | ||
return new Response(`detect accpect-language: ${languages}`) | ||
}) | ||
console.log(`server listening on ${port}`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export const DEFAULT_LANG_TAG = 'en-US' | ||
export const DEFAULT_COOKIE_NAME = 'i18n_locale' | ||
export const ACCEPT_LANGUAGE_HEADER = 'accept-language' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.