mcp
v0.9.2Model Context Protocol (MCP) server for Dialex internationalization
Modern web development demands internationalization that doesn't compromise on runtime performance, developer experience, or type safety. Traditional i18n libraries either scan filesystems on every request, incur heavy bundle bloat, or lack compile-time guarantees. Everything is documented at dialex.awaiden.com, in English, Turkish, Spanish, German and Simplified Chinese: Run the interactive initializer to automatically detect your framework and configure your project:
Summary extracted from the README.
🌍 Dialex
Next-Generation, Type-Safe Internationalization (i18n) Framework
Zero runtime overhead, seamless full-stack DX, and compiler-driven type safety.
Status: pre-1.0. The API can still change between minor versions. Breaking changes are listed in the changelog and ship in a minor release; patch releases stay compatible. Pin the minor version (
~0.8.0) if you need a stable surface.
🚀 Why Dialex?
Modern web development demands internationalization that doesn't compromise on runtime performance, developer experience, or type safety. Traditional i18n libraries either scan filesystems on every request, incur heavy bundle bloat, or lack compile-time guarantees.
Dialex solves this with an Ahead-of-Time compiler model:
- ⚡ Zero Runtime Scanning: Server and edge runtimes consume pre-compiled static dictionaries with zero disk I/O.
- 📦 Zero Dependencies:
dialexjsinstalls nothing else (under 0.4 MB); the scanning and code generation live in the CLI, which is a dev dependency. - 🎯 Total Type Safety: Full autocomplete for dictionary names, keys, and locale signatures powered by automatic TypeScript interface augmentation.
- 🛠️ Universal Architecture: One API across Next.js, React 19, React Router, Preact, Solid, Svelte / SvelteKit, Vue / Nuxt, Qwik, Lit, Angular, React Native / Expo, Astro, Hono, Fastify, Express, Koa, NestJS, Elysia, Hapi, AdonisJS, tRPC, h3 / Nitro, and any Fetch API runtime.
- 🔢 Plurals & Formatting: Typed
plural,number,date,relativeTime, andlisthelpers built onIntl. - 🪜 Locale Fallbacks:
tr-TR→trautomatically, plus explicit chains viafallbacksin the config. - 🧭 Routing: Locale-prefixed URL helpers, hreflang and sitemap generation, a Next.js middleware and
DialexLink. - 🚚 Lazy Loading: Per-dictionary code splitting for Vite apps with
lazy: true. - 📝 ICU Messages:
{count, plural, one {# item} other {# items}}strings, formatted byt()with CLDR plural rules for every language. - 🔑 Key Paths: A typed
t("home.nav.about")alongsidegetDictionary. - 🧰 Developer-First CLI:
@dialexjs/cliscaffolds projects with AST precision (Magicast), watches dictionary files with instantaneous codegen, and audits translation parity in CI. - 🔍 Lint Rules:
@dialexjs/eslint-pluginreports unknown dictionaries and keys, dynamic keys and hard-coded text in ESLint and oxlint, configured once underlint.rulesindialex.config.ts.
📦 Packages
| Package | Version | Description |
|---|---|---|
dialexjs |
Core runtime library and framework adapters | |
@dialexjs/cli |
Standalone CLI (dialex, dx) for scaffolding, codegen, and CI parity checks |
|
@dialexjs/mcp |
Model Context Protocol (MCP) server for AI assistants and agent skills | |
@dialexjs/eslint-plugin |
ESLint and oxlint rules: unknown dictionaries and keys, dynamic keys, hard-coded text | |
@dialexjs/language-server |
LSP server: diagnostics, hover, go to definition, completion and quick fixes |
📚 Documentation
Everything is documented at dialex.awaiden.com, in English, Turkish, Spanish, German and Simplified Chinese:
| Start here | When you need |
|---|---|
| Getting Started | A first working project |
| How Dialex works | The whole pipeline in one page |
| Frameworks | Your framework's setup, options and troubleshooting |
| API reference | Every export, with signatures, parameters and examples |
| CLI reference | Commands, options, exit codes and JSON output |
| Migrating | Moving from i18next, react-intl, next-intl or vue-i18n |
| Troubleshooting | Something does not work, and the FAQ |
🏁 Quick Start
1. Installation
# Using Bun
bun add dialexjs
bun add -d @dialexjs/cli
# Using npm
npm install dialexjs
npm install -D @dialexjs/cli
# Using pnpm
pnpm add dialexjs
pnpm add -D @dialexjs/cli
2. Scaffold with CLI
Run the interactive initializer to automatically detect your framework and configure your project:
bun x dialex init
Or run headlessly in automated setups:
bun x dialex init --framework fastify --default-locale en --locales en,tr -y
This generates dialex.config.ts, a starter dictionary src/home.content.ts, adds dialexjs and @dialexjs/cli to your package.json, and adds the "dx:generate": "dx generate" script (then run your package manager's install).
📖 Dictionaries & Type Safety
Dictionaries are defined using defineDictionary:
// src/home.content.ts
import { defineDictionary } from "dialexjs";
export default defineDictionary("home", {
en: {
title: "Welcome to Dialex!",
description: "Type-safe internationalization.",
greeting: (name: string) => `Hello, ${name}!`,
},
tr: {
title: "Dialex'e Hoş Geldiniz!",
description: "Tip güvenli uluslararasılaştırma.",
greeting: (name: string) => `Merhaba, ${name}!`,
},
});
Whenever you run dialex generate (or during dev watch mode), Dialex compiles:
src/dialex.generated.ts: A statically imported registry of dictionaries.src/dialex-env.d.ts: Ambient module declarations that register your dictionary schema with the TypeScript compiler:
const dict = req.getDictionary("home");
// ✅ Autocompletion for:
// - dict.title
// - dict.description
// - dict.greeting("Alice")
🌐 Framework Integrations
Next.js (App Router Path Routing)
Generate the dictionaries with dx generate, then bind them once for server code:
// src/dialex.ts
import { createDialexServer } from "dialexjs/server";
import { dialex } from "./dialex.generated";
export const { getDictionary, getT } = createDialexServer(dialex);
Add the middleware that keeps every page under a locale prefix:
// proxy.ts (named middleware.ts before Next.js 16)
import { createDialexMiddleware } from "dialexjs/next/middleware";
export default createDialexMiddleware({ locales: ["en", "tr"], defaultLocale: "en" });
export const config = {
matcher: ["/((?!_next|api|.*\\..*).*)"],
};
Use DialexLink from dialexjs/next/link for links that keep the current locale.
Server Components:
// src/app/[locale]/page.tsx
import { getDictionary } from "../../dialex";
export default async function Page({ params }: { params: Promise<{ locale: string }> }) {
const { locale } = await params;
const dict = getDictionary("home", locale as any);
return (
<main>
<h1>{dict.title}</h1>
<p>{dict.greeting("User")}</p>
</main>
);
}
Fastify
import { dialexPlugin } from "dialexjs/fastify";
import Fastify from "fastify";
import { dialex } from "./src/dialex.generated.js";
const app = Fastify();
await app.register(dialexPlugin, { ...dialex });
app.get("/:locale", async (req) => {
const dict = req.getDictionary("home");
return { title: dict.title, locale: req.locale };
});
await app.listen({ port: 3000 });
Koa
import Router from "@koa/router";
import { dialexKoa } from "dialexjs/koa";
import Koa from "koa";
import { dialex } from "./src/dialex.generated.js";
const app = new Koa();
const router = new Router();
app.use(dialexKoa({ ...dialex }));
router.get("/:locale", (ctx) => {
const dict = ctx.getDictionary("home");
ctx.body = { title: dict.title, locale: ctx.locale };
});
app.use(router.routes());
app.listen(3000);
Hono
import { dialexHono } from "dialexjs/hono";
import { Hono } from "hono";
import { dialex } from "./src/dialex.generated.js";
const app = new Hono();
app.use("*", dialexHono({ ...dialex }));
app.get("/:locale", (c) => {
const dict = c.var.getDictionary("home");
return c.json({ title: dict.title, locale: c.var.locale });
});
export default app;
Express
import { dialexExpress } from "dialexjs/express";
import express from "express";
import { dialex } from "./src/dialex.generated.js";
const app = express();
app.use(dialexExpress({ ...dialex }));
app.get("/:locale", (req, res) => {
const dict = req.getDictionary("home");
res.json({ title: dict.title, locale: req.locale });
});
app.listen(3000);
NestJS
import { Module, Controller, Get } from "@nestjs/common";
import { DialexModule, DialexLocale, DialexDictionary } from "dialexjs/nestjs";
import { dialex } from "./src/dialex.generated.js";
@Controller()
export class AppController {
@Get(":locale")
getHome(@DialexLocale() locale: string, @DialexDictionary("home") dict: any) {
return { title: dict.title, locale };
}
}
@Module({
imports: [DialexModule.forRoot({ ...dialex })],
controllers: [AppController],
})
export class AppModule {}
Elysia, SvelteKit, Astro, Vue / Nuxt, Svelte, Solid, Preact, Qwik, Lit, React Native, Hapi, AdonisJS, tRPC, React Router, Angular
Adapters for these ship as dialexjs/elysia, dialexjs/sveltekit, dialexjs/astro, dialexjs/vue, dialexjs/nuxt, dialexjs/svelte, dialexjs/solid, dialexjs/preact, dialexjs/qwik, dialexjs/lit, dialexjs/react-native, dialexjs/hapi, dialexjs/adonis, dialexjs/trpc and dialexjs/angular. React Router uses dialexjs/web with dialexjs/react. Every framework has a detailed page, with best practices and troubleshooting, on the docs site (apps/docs).
React 19 / Vite
Run dx generate (or keep dx generate --watch running, or use the VS Code extension), then give the provider the generated dictionaries. There is no bundler plugin:
// src/main.tsx
import { DialexProvider } from "dialexjs/react";
import { dialex } from "./dialex.generated";
createRoot(document.getElementById("root")!).render(
<DialexProvider {...dialex}>
<App />
</DialexProvider>,
);
// src/App.tsx
import { useDialex, useDictionary } from "dialexjs/react";
export function App() {
const { locale, setLocale } = useDialex();
const dict = useDictionary("home");
return (
<div>
<h1>{dict.title}</h1>
<button onClick={() => setLocale(locale === "en" ? "tr" : "en")}>
Switch Locale ({locale})
</button>
</div>
);
}
🛠️ CLI Reference
dialex init
Set up Dialex with interactive prompts or headless CLI flags.
bun x dialex init
dialex generate (gen)
Statically compiles dictionary files to src/dialex.generated.ts and src/dialex-env.d.ts.
bun x dialex generate
bun x dialex generate --watch
dialex check (lint)
Audits dictionaries and how your code uses them. Exits with code 1 on errors.
bun x dialex check
bun x dialex check --fix # insert missing keys marked [TODO]
bun x dialex check --github # GitHub Actions annotations
bun x dialex check --json # machine-readable output
It reports missing keys (including nested ones), calls to dictionaries or t("dict.path") keys that do not exist, and warns about possibly unused keys and leftover [TODO] placeholders.
dialex export / dialex import
Round-trip strings with translators as JSON, CSV or XLIFF 1.2, without editing TypeScript.
bun x dialex export -f xliff -o translations
bun x dialex import translations/tr.xlf
dialex translate
Fills missing (or [TODO]) strings through a provider configured in dialex.config.ts. Claude, OpenAI (ChatGPT), Gemini and DeepL providers are built in (@dialexjs/cli/translate). --dry-run lists what would be translated without calling anything.
bun x dialex translate --dry-run
bun x dialex translate -l tr de
Full documentation lives in apps/docs (VuePress): run bun run docs:dev. The site is available in English, Turkish, Spanish, German and Simplified Chinese; the translations were written by an AI assistant and are awaiting review by native speakers (see apps/docs/TRANSLATING.md).
📁 Examples Repository
Check out runnable projects in examples/:
examples/next: Next.js 15 App Router path routing (app/[locale]) with SSGexamples/fastify: Fastify 5 REST API with decorator supportexamples/koa: Koa 2 REST API with cascading middlewareexamples/hono: Lightweight Hono serverexamples/express: Express 5 serverexamples/nestjs: Enterprise NestJS application with interceptors & decoratorsexamples/react: Vite + React 19 Client SPAexamples/react-router: React Router 8 (framework mode, SSR) with locale detection in the root loaderexamples/vue: Vite + Vue 3 SPA withcreateDialexexamples/svelte: Vite + Svelte 5 SPA withdialexjs/svelteexamples/solid: Vite + SolidJS SPA withdialexjs/solidexamples/preact: Vite + Preact SPA withdialexjs/preactexamples/qwik: Vite + Qwik (client-side rendering) withdialexjs/qwikexamples/lit: Vite + Lit web components withdialexjs/litexamples/expo: Expo (React Native) app withdialexjs/react-nativeexamples/hapi: Hapi server withdialexjs/hapiexamples/adonis: AdonisJS 6 app withdialexjs/adonisexamples/trpc: tRPC server withdialexjs/trpcexamples/tanstack: TanStack Start (SSR) with locale detection in a server function throughdialexjs/web
🧩 VS Code Extension
packages/vscode adds diagnostics, hover, go to definition, completion and quick fixes for translations. It reads your config and dictionaries without running them. Every GitHub Release has the packaged dialex-vscode-X.Y.Z.vsix attached; see apps/docs (VS Code Extension) for install and usage.
🧭 Other editors (Zed, Neovim, Helix)
@dialexjs/language-server speaks the Language Server Protocol and gives any LSP client the same diagnostics, hover, go to definition, completion and quick fixes. packages/zed is a Zed extension that finds and starts it. See apps/docs (Zed and other editors).
🧪 Testing & Validation
Test your own code with dialexjs/testing (createTestDialex, mockRequest, TestDialexProvider); see the docs.
For this repository:
Run the complete test suite and build verification:
bun run ready # Runs vp check, vp test, and vp build across all workspaces
📝 Changelog
See what changed in each release in the changelog, or on GitHub Releases.
🤖 How it is built
Dialex is developed with AI assistance. The maintainer sets the direction and makes the design decisions, and the code is written together with Claude Code. Commits that were written this way carry a Co-Authored-By trailer.
Nothing is released on trust: every change runs through formatting, linting, type checks, the unit and type tests, the example builds, a packed-tarball smoke test and the documentation checks (see CONTRIBUTING.md). Bug reports about generated code are welcome and handled like any other.
📄 License
MIT License © 2026 awaiden