Skip to main content
Glama
useLocaleStorage.ts1.52 kB
import { getLocaleFromStorage, LocaleStorage, localeStorageOptions, setLocaleInStorage as setLocaleInStorageCore, } from '@intlayer/core'; import type { LocalesValues } from '@intlayer/types'; import { useMemo } from 'react'; /** * Get the locale cookie */ /** * Get the locale cookie */ export const localeInStorage = getLocaleFromStorage(localeStorageOptions); /** * @deprecated Use localeInStorage instead * * Get the locale cookie */ export const localeCookie = localeInStorage; /** * Set the locale cookie */ export const setLocaleInStorage = ( locale: LocalesValues, isCookieEnabled?: boolean ) => setLocaleInStorageCore(locale, { ...localeStorageOptions, isCookieEnabled, }); /** * @deprecated Use setLocaleInStorage instead * * Set the locale cookie */ export const setLocaleCookie = setLocaleInStorage; /** * Hook that provides the locale cookie and a function to set it */ export const useLocaleStorage = (isCookieEnabled?: boolean) => useMemo( () => LocaleStorage({ ...localeStorageOptions, isCookieEnabled, }), [isCookieEnabled] ); /** * @deprecated Use useLocaleStorage instead * * For GDPR compliance, use useLocaleStorage instead * * Hook that provides the locale cookie and a function to set it */ export const useLocaleCookie = (isCookieEnabled?: boolean) => { const storage = useLocaleStorage(isCookieEnabled); return { localeCookie: storage.getLocale(), setLocaleCookie: storage.setLocale, }; };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aymericzip/intlayer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server