--- createdAt: 2025-08-23 updatedAt: 2026-09-27 priority: 5 title: getConfiguration Function Documentation | intlayer description: "Use getConfiguration to read your resolved Intlayer configuration, including locales and routing, on the client or the server." keywords: - getConfiguration - translation - Intlayer - intlayer - Internationalization - Documentation - Next.js - JavaScript - React slugs: - doc - packages - intlayer - getConfiguration history: - version: 9.5.9 date: 2026-09-25 changes: "Deprecate getConfiguration in favor of direct imports from intlayer" - version: 5.5.10 date: 2025-06-29 changes: "Init history" author: aymericzip --- # Documentation: `getConfiguration` Function in `intlayer` (Deprecated) > [!WARNING] > **Deprecated**: The `getConfiguration` function is deprecated. The new recommended way is to import `{ availableLocale, defaultLocales, internationalization, routing, ... }` (such as `defaultLocale`, `locales`, `requiredLocales`, or `editor`) directly from `'intlayer'`: > > ```typescript > import { defaultLocale, locales, requiredLocales, editor } from "intlayer"; > ``` ## Description The `getConfiguration` function retrieves the entire configuration for the `intlayer` application by extracting environment variables. This function provides the flexibility to use the same configuration on both the client and server sides, ensuring consistency across the application. ## Parameters The function does not take any parameters. Instead, it uses environment variables for configuration. ### Returns - **Type**: `IntlayerConfig` - **Description**: An object containing the complete configuration for `intlayer`. The configuration includes the following sections: - `internationalization`: Settings related to locales and strict mode. - `middleware`: Settings related to URL and cookie management. - `content`: Settings related to content files, directories, and patterns. - `editor`: Editor-specific configurations. See [Intlayer configuration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/configuration.md) for more details. - [Intlayer configuration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/configuration.md) ## Example Usage ### Retrieving the Full Configuration ```typescript codeFormat={["typescript", "esm", "commonjs"]} import { getConfiguration } from "intlayer"; const config = getConfiguration(); console.log(config); // Output: // { // internationalization: { ... }, // middleware: { ... }, // content: { ... }, // editor: { ... } // } ``` ### Extracting `availableLocales` and `defaultLocale` > [!TIP] > **Recommended Way**: Instead of extracting locales from `getConfiguration()`, import them directly from `'intlayer'`: > > ```typescript > import { defaultLocale, locales } from "intlayer"; > ``` The `internationalization` section of the configuration provides locale-related settings such as `locales` (available locales) and `defaultLocale` (fallback language). ```typescript codeFormat={["typescript", "esm", "commonjs"]} import { getConfiguration } from "intlayer"; const { internationalization, middleware } = getConfiguration(); const { locales: availableLocales, defaultLocale } = internationalization; const { cookieName } = middleware; console.log(availableLocales); // Output example: ["en", "fr", "es"] console.log(defaultLocale); // Output example: "en" console.log(cookieName); // Output: "INTLAYER_LOCALE" ``` ## Notes - Ensure that all required environment variables are correctly set before calling this function. Missing variables will cause errors during initialization. - This function can be used on both client and server sides, making it a versatile tool for managing configurations in a unified manner. ## Usage in Applications The `getConfiguration` function is a cornerstone utility for initializing and managing the configuration of an `intlayer` application. By providing access to settings like locales, middleware, and content directories, it ensures consistency and scalability across multilingual and content-driven applications.