mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: auto prefixor
This commit is contained in:
1 parent
ffe58de179
commit
260d819c77
6 files changed
+65
-34
No files matched your search
@@ -1,8 +1,12 @@
|
||||
import { DEFAULT_LOCALE, SUPPORTED_LOCALES } from '@blitzkit/core';
|
||||
|
||||
export function getBestLocale() {
|
||||
const desiredLocale = navigator.language.split('-')[0];
|
||||
const isSupported = SUPPORTED_LOCALES.includes(desiredLocale);
|
||||
const desiredLocale =
|
||||
localStorage.getItem('preferred-locale') ??
|
||||
navigator.language.split('-')[0];
|
||||
const isSupported = (SUPPORTED_LOCALES as unknown as string[]).includes(
|
||||
desiredLocale,
|
||||
);
|
||||
const isDefault = desiredLocale === DEFAULT_LOCALE;
|
||||
|
||||
if (!isSupported || isDefault) return undefined;
|
||||
|
||||
Reference in new issue
Block a user