UNPKG

@inlang/paraglide-js

Version:

[![Inlang-ecosystem compatibility badge](https://cdn.jsdelivr.net/gh/opral/monorepo@main/inlang/assets/md-badges/inlang.svg)](https://inlang.com)

30 lines 845 B
/** * 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