/** * Intlayer configuration file documentation * @see https://intlayer.org/doc/concept/configuration */ const { Locales } = require('intlayer'); /** @type {import('intlayer').IntlayerConfig} */ const config = { internationalization: { locales: [Locales.ENGLISH], /** * Default locale used as a fallback if the requested locale is not found. */ defaultLocale: Locales.ENGLISH, }, routing: { /** * Locale routing strategy. * - "prefix-no-default": Prefix all except the default locale (e.g., /dashboard, /fr/dashboard). * - "prefix-all": Prefix all locales (e.g., /en/dashboard, /fr/dashboard). * - "no-prefix": No locale in the URL. * - "search-params": Use search params to define the locale (e.g., /dashboard/?locale=en, /dashboard/?locale=fr) * Default: "prefix-no-default" */ mode: 'prefix-no-default', }, editor: { /** * Whether the visual editor is enabled. */ enabled: false, /** * URL of your application for origin validation. */ applicationURL: 'http://localhost:3000', }, ai: { /** * AI provider to use. * Options: 'openai', 'anthropic', 'mistral', 'deepseek', 'gemini', 'ollama', 'openrouter', 'alibaba', 'fireworks', 'groq', 'huggingface', 'bedrock', 'googlevertex', 'togetherai' */ provider: 'openai', model: 'gpt-5-mini', apiKey: process.env.OPENAI_API_KEY, /** * Additional context for the translations * * Can be use in addition of the dictionary `description` field */ applicationContext: [''].join('\n'), }, compiler: { enabled: true, /** * Defines the output files path for autogenerated content (compiler / autofill / extract) * * - `./` paths are resolved relative to the component directory. * - `/` paths are resolved relative to the project root (`baseDir`). * * - Including the `{{locale}}` variable in the path will trigger the generation of separate dictionaries per locale. * * Example: * ```ts * { * // Create Multilingual .content.ts files close to the component * output: ({ fileName, extension }) => `./${fileName}${extension}`, * } * ``` * * ```ts * { * // Create centralize per-locale JSON at the root of the project * output: ({ key, locale }) => `/locales/${locale}/${key}.content.json`, * } * ``` * * Variable list: * - `fileName`: The name of the file. * - `key`: The key of the content. * - `locale`: The locale of the content. * - `extension`: The extension of the file. * - `componentFileName`: The name of the component file. * - `componentExtension`: The extension of the component file. * - `format`: The format of the dictionary. * - `componentFormat`: The format of the component dictionary. * - `componentDirPath`: The directory path of the component. */ output: ({ fileName }) => `./${fileName}.content.ts`, /** * Indicates if the components should be saved after being transformed. * * - If `true`, the compiler will rewrite the component file in the disk. So the transformation will be permanent, and the compiler will skip the transformation for the next process. That way, the compiler can transform the app, and then it can be removed. * * - If `false`, the compiler will inject the `useIntlayer()` function call into the code in the build output only, and keep the base codebase intact. The transformation will be done only in memory. */ saveComponents: false, }, dictionary: { /** * Controls how dictionaries are imported. * - "static": Statically imported at build time. * - "dynamic": Dynamically imported using Suspense. * - "fetch": Fetched dynamically via the live sync API. */ importMode: 'static', }, build: { /** * (Experimental feature) * * Minify the dictionaries to reduce the bundle size. */ minify: true, /** * (Experimental feature) * * Purge the unused keys in a dictionaries */ purge: true, /** * Indicates if the build should check TypeScript types */ checkTypes: false, } }; module.exports = config;