--- createdAt: 2026-09-19 updatedAt: 2026-09-19 title: useLocale Hook Documentation | astro-intlayer description: See how to use the useLocale hook in Astro applications to access and manage the current locale. keywords: - useLocale - locale - astro - astro-intlayer - Intlayer - intlayer - Internationalization - Documentation slugs: - doc - packages - astro-intlayer - useLocale history: - version: 9.5.5 date: 2026-09-19 changes: "Init doc" author: aymericzip --- # useLocale Hook Documentation The `useLocale` hook from `astro-intlayer` provides access to the current request locale, the configured default locale, and all available locales in Astro applications. It behaves consistently across server-rendered `.astro` frontmatter and client-side ` ``` ## Return Values The hook returns an object of type `UseLocaleResult`: | Property | Type | Description | | ------------------ | -------------------------------------- | ------------------------------------------------------------------------------------ | | `locale` | `DeclaredLocales` | The active locale. | | `defaultLocale` | `DeclaredLocales` | The default fallback locale configured in `intlayer.config.ts`. | | `availableLocales` | `DeclaredLocales[]` | Array of all supported locales configured for the project. | | `setLocale` | `(locale: LocalesValues) => void` | Function to update the locale. (Interactive in client `