Skip to content

aymericzip/intlayer-skills / skills/intlayer-usage

intlayer-usage

Verified

Provides general guidelines for using Intlayer in any project. Use when the user asks to "get started with Intlayer", "declare content files", or understand the "project structure" for internationalization.

FileKindSize
LICENCE.mdmarkdown10.7 KB
SKILL.mdskill md3.6 KB
references/concept_how-works-intlayer.mdmarkdown28.7 KB
references/concept_per-locale-file.mdmarkdown7.6 KB
references/get-started.mdmarkdown26.6 KB
references/packages_intlayer_comparePaths.mdmarkdown5.0 KB
references/packages_intlayer_exports.mdmarkdown12.4 KB
references/packages_intlayer_getCanonicalPath.mdmarkdown3.4 KB
references/packages_intlayer_getConfiguration.mdmarkdown4.1 KB
references/packages_intlayer_getDictionary.mdmarkdown4.9 KB
references/packages_intlayer_getDictionaryAsync.mdmarkdown6.3 KB
references/packages_intlayer_getEnumeration.mdmarkdown3.3 KB
references/packages_intlayer_getHTMLTextDir.mdmarkdown2.3 KB
references/packages_intlayer_getIntlayer.mdmarkdown8.7 KB
references/packages_intlayer_getIntlayerAsync.mdmarkdown6.8 KB
references/packages_intlayer_getLocale.mdmarkdown1.1 KB
references/packages_intlayer_getLocaleLang.mdmarkdown1.9 KB
references/packages_intlayer_getLocaleName.mdmarkdown3.5 KB
references/packages_intlayer_getLocalizedPath.mdmarkdown6.8 KB
references/packages_intlayer_getLocalizedUrl.mdmarkdown9.3 KB
references/packages_intlayer_getMultilingualUrls.mdmarkdown8.7 KB
references/packages_intlayer_getPathWithoutLocale.mdmarkdown1.6 KB
references/packages_intlayer_getPrefix.mdmarkdown6.0 KB
references/packages_intlayer_getTranslation.mdmarkdown3.4 KB
references/packages_intlayer_validatePrefix.mdmarkdown1.0 KB
references/packages_react-intlayer_exports.mdmarkdown13.7 KB
references/packages_vite-intlayer_exports.mdmarkdown6.0 KB
references/packages_vite-intlayer_intlayer.mdmarkdown6.0 KB
references/packages_vite-intlayer_intlayerCompiler.mdmarkdown4.2 KB
references/packages_vite-intlayer_intlayerMinify.mdmarkdown3.9 KB
references/packages_vite-intlayer_intlayerProxy.mdmarkdown7.0 KB
references/packages_vite-intlayer_intlayerPrune.mdmarkdown4.7 KB
references/why.mdmarkdown58.2 KB

references/packages_vite-intlayer_intlayerCompiler.md

View on GitHub
---
createdAt: 2026-06-25
updatedAt: 2026-06-25
priority: 5
title: intlayerCompiler Vite Plugin Documentation | vite-intlayer
description: Vite plugin that extracts inline Intlayer content declarations from component files and writes them to dictionary JSON files at build/transform time.
keywords:
  - intlayerCompiler
  - vite
  - plugin
  - compiler
  - content
  - dictionary
  - internationalization
  - i18n
slugs:
  - doc
  - packages
  - vite-intlayer
  - intlayerCompiler
history:
  - version: 9.0.0
    date: 2026-06-25
    changes: "Bundled into intlayer(); init doc"
author: aymericzip
---

# intlayerCompiler

`intlayerCompiler` is a Vite plugin that scans component source files for **inline Intlayer content declarations**, content defined directly inside a component rather than in a separate `.content.ts` file, and writes them to dictionary JSON files during the transform phase.

> **Since Intlayer v9** `intlayerCompiler` is automatically included inside the main [`intlayer()`](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/packages/vite-intlayer/intlayer.md) plugin when both `compiler.enabled` is `true` and `compiler.output` is set in your Intlayer config. You only need to register it separately when you want full control over compiler-specific configuration.

- [`intlayer()`](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/packages/vite-intlayer/intlayer.md)

## Usage

### As part of `intlayer()` (recommended, v9+)

Enable the compiler through your Intlayer config:

```ts
// intlayer.config.ts
import { defineConfig } from "intlayer";

export default defineConfig({
  compiler: {
    enabled: true,
    output: "./src/dictionaries", // where extracted dictionaries are written
  },
});
```

Then use the standard plugin with no extra registration:

```ts
// vite.config.ts
import { defineConfig } from "vite";
import { intlayer } from "vite-intlayer";

export default defineConfig({
  plugins: [intlayer()],
});
```

### Standalone (when needed)

```ts
// vite.config.ts
import { defineConfig } from "vite";
import { intlayerCompiler } from "vite-intlayer";

export default defineConfig({
  plugins: [intlayerCompiler()],
});
```

## Options

```ts
import type { IntlayerCompilerOptions } from "vite-intlayer";
```

| Option           | Type                      | Description                                                                                 |
| ---------------- | ------------------------- | ------------------------------------------------------------------------------------------- |
| `configOptions`  | `GetConfigurationOptions` | Intlayer configuration overrides forwarded to `getConfiguration()`.                         |
| `compilerConfig` | `Partial<CompilerConfig>` | Overrides for the compiler-specific config section (e.g. `enabled`, `output`, `filesList`). |

### Example

```ts
intlayerCompiler({
  configOptions: { configFile: "./config/intlayer.config.ts" },
  compilerConfig: { enabled: true, output: "./src/dictionaries" },
});
```

## How it works

### Transform phase

For every source file that matches `compiler.filesList`, the compiler plugin:

1. Passes the file content through `extractContent` from `@intlayer/babel`.
2. Calls `onExtract` for each declaration found, which writes the resulting dictionary JSON to `compiler.output`.
3. Returns the transformed source code with inline declarations replaced by standard `useIntlayer('key')` / `getIntlayer('key')` calls.

Supported file types: `.ts`, `.tsx`, `.js`, `.jsx`, `.vue`, `.svelte`, `.astro`.

### HMR (Hot Module Replacement)

When a component file is saved in development mode, the compiler:

1. Detects the file change via Vite's `handleHotUpdate` hook.
2. Re-extracts content from the updated file.
3. Writes the updated dictionary JSON.
4. Triggers a full page reload (`server.ws.send({ type: 'full-reload' })`).

A 500 ms debounce prevents the dictionary write itself (which also triggers a file-change event) from causing an infinite re-extraction loop.

### Deduplication

`intlayerCompiler` uses the same `createPrimaryInstanceGuard` deduplication mechanism as the other bundled plugins. When both `intlayer()` (which bundles the compiler) and a manual `intlayerCompiler()` call are present, only the first registered instance runs, no dictionaries are written twice.
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 197kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall