Files
plagiat/src/shared/lib/getLocaleCS.ts
nabijonovdavronbek619@gmail.com 6265edf673 init create-fias
2026-03-30 11:50:07 +05:00

14 lines
400 B
TypeScript

import { LanguageRoutes } from '../config/i18n/types';
const getLocaleCS = (): LanguageRoutes | undefined => {
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
const match = document.cookie
.split('; ')
.find((row) => row.startsWith('NEXT_LOCALE='));
return match?.split('=')[1] as LanguageRoutes;
}
return undefined;
};
export default getLocaleCS;