Intlayer
/

intlayer / README.md
TornadoAI's picture
Duplicate from aymericzip/intlayer
07af936
|
Raw History Blame Contribute Delete
5.65 kB
# Intlayer AI Site (`ai.intlayer.org`)
Landing page and web showcase for [ai.intlayer.org](https://ai.intlayer.org) β€” highlighting **Intlayer**'s AI-powered internationalization (i18n), dynamic content generation, A/B testing, and AI-driven translation workflows.
---
## 🌟 About Intlayer
[Intlayer](https://intlayer.org) is an open-source, modern internationalization (i18n) framework designed for JavaScript and TypeScript applications (React, Next.js, Vite, Vue, Svelte, Express, and more). Beyond traditional key-value dictionaries, Intlayer treats content declaration as code and integrates AI tools to streamline localization, translation maintenance, and content auditing.
Explore the live AI landing page at [ai.intlayer.org](https://ai.intlayer.org).
---
## πŸ€– Intlayer AI CLI Tools
Intlayer provides powerful CLI commands driven by AI models (OpenAI, Anthropic, Mistral, Google Gemini, Ollama, etc.) to automate and maintain translations across codebases and documentation.
### 1. `intlayer fill` β€” AI Dictionary Audit & Fill
The [`intlayer fill`](https://intlayer.org/doc/concept/cli/fill) command inspects your content declaration files (`*.content.{ts,js,tsx,jsx,json}`) for missing translations, structural inconsistencies, or type discrepancies. It automatically uses AI to complete missing locales while preserving existing keys and context.
```bash
# Audit and automatically fill missing translations in all dictionaries
npx intlayer fill
# Target specific content declaration files
npx intlayer fill -f src/components/Hero.content.ts
# Target specific dictionary keys
npx intlayer fill -k heroSection navbar
# Choose a specific AI provider and model
npx intlayer fill --provider openai --model gpt-4o
```
**Key Features:**
- **Smart Chunking:** Automatically divides large JSON/content files into manageable blocks to stay within token context limits.
- **Context-Aware:** Incorporates surrounding application and file context for natural, idiomatic translations.
- **Non-Destructive:** Retains existing translations and only updates missing or mismatched fields.
- **Parallel Processing:** Uses concurrent queues across files and locales to optimize speed.
πŸ“– [Read the full `intlayer fill` documentation](https://intlayer.org/doc/concept/cli/fill)
---
### 2. `intlayer doc translate` β€” AI Documentation Translation
The [`intlayer doc translate`](https://intlayer.org/doc/concept/cli/doc-translate) command automatically translates markdown and MDX documentation files from a base locale to target locales using AI models.
```bash
# Translate docs matching a pattern to specific locales
npx intlayer doc translate --doc-pattern "docs/**/*.md" --base-locale en --locales fr es de
# Skip files that have not changed recently
npx intlayer doc translate --skip-if-exists
# Run with custom concurrency
npx intlayer doc translate --nb-simultaneous-file-processed 4
```
**Key Features:**
- **Markdown & MDX Aware:** Preserves frontmatter, code blocks, and markdown structure during translation.
- **Large Document Chunking:** Splits lengthy guides and documentation into coherent chunks.
- **Configurable Locales:** Explicitly control source and target locales or rely on your `intlayer.config.ts`.
πŸ“– [Read the full `intlayer doc translate` documentation](https://intlayer.org/doc/concept/cli/doc-translate)
---
### 3. `intlayer doc review` β€” Documentation Quality & Sync Audit
The [`intlayer doc review`](https://intlayer.org/doc/concept/cli/doc-review) command checks translated documentation against the source base documentation to ensure consistency, find diverging sections, and apply fixes.
```bash
# Review existing translated docs and apply AI updates to outdated sections
npx intlayer doc review --doc-pattern "docs/**/*.md" --base-locale en --locales fr es
# Generate a report of diverging blocks without modifying files
npx intlayer doc review --mode report
# Display only the high-level status synthesis
npx intlayer doc review --mode synthesis
```
**Modes:**
- `apply` *(default)*: Analyzes diverging sections with AI, updates out-of-sync blocks, and writes the translated files.
- `report`: Runs a dry run without calling AI translation APIs; logs out-of-date blocks with line numbers for manual or agentic review.
- `synthesis`: Skips block-level logging and prints an executive summary of up-to-date and pending files.
πŸ“– [Read the full `intlayer doc review` documentation](https://intlayer.org/doc/concept/cli/doc-review)
---
## πŸš€ Running This Website Locally
This repository contains the static deployment of [ai.intlayer.org](https://ai.intlayer.org) served with Nginx via Docker.
### Prerequisites
- [Docker](https://www.docker.com/) installed on your machine.
### Build and Run
1. **Build the Docker container:**
```bash
docker build -t intlayer-ai -f ./Dockerfile .
```
2. **Run the container:**
```bash
docker run --rm -p 8000:80 --name intlayer-ai-app intlayer-ai
```
3. Open your browser and navigate to `http://localhost:8000`.
---
## πŸ”— Useful Links
- **Website:** [ai.intlayer.org](https://ai.intlayer.org)
- **Official Intlayer Website:** [intlayer.org](https://intlayer.org)
- **CLI Fill Guide:** [intlayer.org/doc/concept/cli/fill](https://intlayer.org/doc/concept/cli/fill)
- **CLI Doc Translate Guide:** [intlayer.org/doc/concept/cli/doc-translate](https://intlayer.org/doc/concept/cli/doc-translate)
- **CLI Doc Review Guide:** [intlayer.org/doc/concept/cli/doc-review](https://intlayer.org/doc/concept/cli/doc-review)
- **GitHub Repository:** [github.com/aymericzip/intlayer](https://github.com/aymericzip/intlayer)