Files
wg-easy-ca-lose/src/i18n/localeDetector.ts
T
Bernd StorathandGitHub 2af5cd04b4 chore: disable auto imports (#2672)
* disable auto imports

* fix imports

* improve cli imports

* fix imports

* fix import cycle

* fix imports
2026-06-19 15:24:42 +02:00

31 lines
624 B
TypeScript

import {
tryCookieLocale,
tryHeaderLocale,
tryQueryLocale,
} from '@intlify/utils/h3';
import type { H3Event } from 'h3';
// TODO: use defineI18nLocaleDetector
export default (event: H3Event, config: { defaultLocale: string }) => {
const query = tryQueryLocale(event, { lang: '' });
if (query) {
return query.toString();
}
const cookie = tryCookieLocale(event, {
lang: '',
name: 'i18n_redirected',
});
if (cookie) {
return cookie.toString();
}
const header = tryHeaderLocale(event, { lang: '' });
if (header) {
return header.toString();
}
return config.defaultLocale;
};