-
-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: unable to configure server integration using inline options (#3020)
- Loading branch information
1 parent
3c3277e
commit 6c51eb4
Showing
5 changed files
with
48 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Detect based on query, cookie, header | ||
export default defineI18nLocaleDetector((event, config) => { | ||
// try to get locale from query | ||
const query = tryQueryLocale(event, { lang: '' }) // disable locale default value with `lang` option | ||
if (query) { | ||
return query.toString() | ||
} | ||
|
||
// try to get locale from cookie | ||
const cookie = tryCookieLocale(event, { lang: '', name: 'i18n_locale' }) // disable locale default value with `lang` option | ||
if (cookie) { | ||
return cookie.toString() | ||
} | ||
|
||
// try to get locale from header (`accept-header`) | ||
const header = tryHeaderLocale(event, { lang: '' }) // disable locale default value with `lang` option | ||
if (header) { | ||
return header.toString() | ||
} | ||
|
||
// If the locale cannot be resolved up to this point, it is resolved with the value `defaultLocale` of the locale config passed to the function | ||
return config.defaultLocale | ||
}) |
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,7 @@ | ||
import { useTranslation } from '@intlify/h3' | ||
|
||
export default defineEventHandler(async event => { | ||
const t = await useTranslation(event) | ||
|
||
return t('home') | ||
}) |
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