@inlang/paraglide-js
Version:
[](https://inlang.com)
30 lines • 845 B
TypeScript
/**
* Get the current locale.
*
* @example
* if (getLocale() === 'de') {
* console.log('Germany 🇩🇪');
* } else if (getLocale() === 'nl') {
* console.log('Netherlands 🇳🇱');
* }
*
* @type {() => Locale}
*/
export let getLocale: () => Locale;
/**
* Overwrite the \`getLocale()\` function.
*
* Use this function to overwrite how the locale is resolved. For example,
* you can resolve the locale from the browser's preferred language,
* a cookie, env variable, or a user's preference.
*
* @example
* overwriteGetLocale(() => {
* // resolve the locale from a cookie. fallback to the base locale.
* return Cookies.get('locale') ?? baseLocale
* }
*
* @type {(fn: () => Locale) => void}
*/
export const overwriteGetLocale: (fn: () => Locale) => void;
//# sourceMappingURL=get-locale.d.ts.map