Simple locale management with global state.
npm install @agape/localeimport { getLocale, setLocale } from '@agape/locale';
// Get current locale
const locale = getLocale(); // "en-US"
// Set locale
setLocale('fr-FR');
console.log(getLocale()); // "fr-FR"
// Reset to system locale
setLocale(null);Returns the current locale. If no locale has been set, returns the system locale.
Sets the current locale. Pass null or undefined to reset to system locale.
Throws an error if the locale is invalid.
See the full API documentation at agape.dev/api.
This package is part of the Agape Toolkit - a comprehensive collection of TypeScript utilities and libraries for modern web development.