Skip to main content
Glama

i1n

让你的应用支持所有语言。只需一条命令。

npm license MCP Listed on MCP Servers Security: DeepSec

demo

代码即本地化。推送你的翻译键值,AI 会将其翻译为 182 种语言,并拉取类型安全的 TypeScript 定义。专为开发者、AI 智能体和产品团队打造。

永久免费 · 无需信用卡 · i1n.ai


为什么选择 i1n?

传统的 i18n 意味着数十个 JSON 文件、零类型安全、数小时的复制粘贴,以及在凌晨 2 点崩溃的部署。现有的工具每月收费 120 美元以上,且需要基于浏览器的操作流程。

i1n 与众不同:

  • 一条命令i1n push --translate es,fr,ja 即可完成

  • 类型安全 — 自动生成 i1n.d.ts,提供完整的 IDE 自动补全

  • AI 原生 — 为 Cursor、Claude Code、Windsurf 提供 MCP 服务器。你的智能体可以为你处理 i18n

  • 零迁移 — 桥接模式 (Bridge Mode) 可封装你现有的 i18next/next-intl/vue-i18n

  • 成本降低 6 倍 — 包含免费层级。Pro 版每月 19 美元,而 Lokalise 每月 120 美元


Related MCP server: i18n Agent

📦 安装

# To use the CLI (global)
npm install -g i1n

# To use the SDK + types (in your app)
npm install i1n

# Local CLI usage (optional)
npm install -D i1n

支持 npmpnpmyarnbun


🏁 快速开始

# 1. Initialize (auth + auto-detect setup)
i1n init

# 2. Push your translation keys
i1n push

# 3. Pull translations + auto-generated TypeScript types
i1n pull

✨ 核心功能与命令

🛠️ i1n init

交互式设置,准备你的工作区。

  • 通过 API 密钥进行身份验证。

  • 新用户? 如果你还没有密钥,CLI 会提供清晰的入门指南。

  • 自动检测框架(Next.js、Vite、Expo、Flutter、Rails 等)。

  • 将配置保存到 i1n.config.json(自动通过 .gitignore 忽略)。

  • AI 编排:可选择为你的 AI 编码工具设置规则。

⬆️ i1n push

将本地翻译同步到 i1n。

  • 检测新键值和源文件更改。

  • 智能翻译:在继续之前提供缺失键值的翻译建议及成本估算。

  • 高效的缓存层 — 重复翻译的成本仅为全新翻译的一小部分。

⬇️ i1n pull

下载翻译并生成类型安全的 ID。

  • 以你配置的格式更新本地语言环境文件。

  • 生成 i1n.d.ts 以实现完整的 IDE 自动补全。

📊 i1n limits

实时使用情况跟踪。

  • 查看你当前的套餐和额度使用情况。

  • 监控活跃语言槽位和可用容量。

🧠 i1n setup-ai

将你的 IDE 变成本地化专家。

  • Cursor (.mdc)Claude Code (CLAUDE.md)Windsurf 等生成项目特定的规则。

  • 确保 AI 智能体遵循你的命名规范、文件结构和品牌语调。

🔌 i1n mcp

面向 AI 编码助手的 MCP 服务器。

启动一个 Model Context Protocol 服务器,让 Cursor、Claude Code、Windsurf 和其他 AI 助手直接从你的 IDE 执行 i1n 命令。

# Add to Claude Code
claude mcp add i1n -- npx i1n mcp

# Or add to .mcp.json / cursor config
{
  "mcpServers": {
    "i1n": {
      "command": "npx",
      "args": ["i1n", "mcp"]
    }
  }
}

提供 8 个工具:

工具

描述

i1n_status

获取项目状态、套餐、限制和活跃语言

i1n_push

推送本地翻译文件并自动检测差异

i1n_pull

拉取翻译并生成类型安全的 TypeScript 定义

i1n_translate

使用 AI 将键值翻译为指定语言

i1n_add_language

添加新语言,支持可选的自动翻译

i1n_extract_and_translate

从代码中提取字符串,作为键值推送,并翻译为所有语言

i1n_search

按名称或值搜索现有的翻译键值

i1n_setup_bridge

检测你的 i18n 库(i18next、vue-i18n、next-intl 等)并端到端连接 i1n 桥接模式

杀手级工作流 — 告诉你的 AI 智能体“国际化这个组件”:

  1. 智能体读取你的文件并识别硬编码字符串

  2. 它使用提取的字符串调用 i1n_extract_and_translate

  3. i1n 推送键值,翻译为所有活跃语言,并生成类型

  4. 智能体使用 t('key') 调用重写你的组件

将 60 分钟的任务缩短至 30 秒。


📁 支持的格式

格式

框架

文件示例

嵌套 JSON

i18next, next-intl, vue-i18n

en/common.json

扁平 JSON

React Native, Generic

locales/en.json

ARB

Flutter / Dart

app_en.arb

YAML

Ruby on Rails

en.yml

Android XML

Native Android

strings.xml

Apple Strings

iOS / macOS

Localizable.strings

TypeScript

类型安全 JSON

locales/en.ts


🧩 SDK 使用

i1n 包包含一个用于 Web 和移动端 JS/TS 项目的运行时 SDK。你可以通过两种方式使用它:

独立模式 — 替换你的 i18n 库

直接使用 i1n 原生引擎。无需外部依赖。

import { init, t, setLocale } from "i1n";

// Load your translation resources
init({
  locale: "en_us",
  resources: {
    en_us: {
      auth: { login: "Login", title: "Welcome back, {user}" },
      items_one: "One item",
      items_other: "{count} items",
    },
    es_es: {
      auth: { login: "Entrar", title: "Bienvenido de nuevo, {user}" },
      items_one: "Un elemento",
      items_other: "{count} elementos",
    },
  },
});

// Autocomplete and type-safety work out of the box after 'i1n pull'
t("auth.login"); // "Login"

// Support for default values (useful during development)
t("new.key", { defaultValue: "Coming soon..." }); // "Coming soon..."

// Variables & Plurals
t("auth.title", { user: "Fran" }); // "Welcome back, Fran"
t("items", { count: 5 }); // "5 items"

// Switch language at runtime
setLocale("es_es");
t("auth.login"); // "Entrar"

键值解析会自动处理嵌套和扁平结构 — 使用你项目偏好的任何格式即可。

桥接模式 — 保留你的库,增加类型安全

已经在用 i18next、vue-i18n 或 react-intl 了?用一行代码将其连接到 i1n,即可获得完整的自动补全。

import i18next from "i18next";
import { registerI1n, t } from "i1n";

// Set up i18next as usual
await i18next.init({
  lng: "en",
  resources: {
    /* ... */
  },
});

// Connect to i1n — one line
registerI1n((key, params) => i18next.t(key, params));

// Now t() uses i18next under the hood, but with strict type checking
t("common.greeting", { name: "World" }); // Powered by i18next, typed by i1n

适用于任何库:

  • vue-i18n: registerI1n((key, params) => i18n.global.t(key, params))

  • react-intl: registerI1n((key, params) => intl.formatMessage({ id: key }, params))

  • 自定义: registerI1n((key) => myLookup(key))

复数化

使用 _zero_one_other 后缀定义复数变体:

// In your translation files:
// "items_zero": "No items"
// "items_one": "One item"
// "items_other": "{count} items"

t("items", { count: 0 }); // "No items"
t("items", { count: 1 }); // "One item"
t("items", { count: 5 }); // "5 items"

插值

通用支持三种语法:{var}, {{var}}, %{var}

JavaScript (无 TypeScript)

SDK 可在纯 JS 中使用 — 只是没有自动补全:

import { init, t } from "i1n";
init({ locale: "en_us", resources: { en_us: { greeting: "Hello {name}" } } });
t("greeting", { name: "World" }); // "Hello World"

⚛️ React / Preact 集成

为了实现“即插即用”的体验,请使用这种极简的 Provider 模式。

import { createContext, useContext, useState, useEffect } from "react";
import { init, t, getLocale, setLocale as sdkSetLocale } from "i1n";

// 1. Initialize with wordings
// (In a real app, you'd probably import these from your locales folder)
init({
  locale: "en_us",
  resources: {
    /* ... */
  },
});

const STORAGE_KEY = "i1n-locale";
const I1nContext = createContext({
  locale: "en_us",
  setLocale: (l: string) => {},
});

// 2. Persistent Provider
export function I1nProvider({ children, defaultLocale = "en_us" }) {
  const [locale, setLocaleState] = useState(() => {
    return localStorage.getItem(STORAGE_KEY) || defaultLocale;
  });

  // Keep SDK in sync
  useEffect(() => {
    sdkSetLocale(locale);
  }, [locale]);

  const setLocale = (newLocale: string) => {
    localStorage.setItem(STORAGE_KEY, newLocale);
    setLocaleState(newLocale);
  };

  return (
    <I1nContext.Provider value={{ locale, setLocale }}>
      {children}
    </I1nContext.Provider>
  );
}

// 3. Simple Hook
export const useI1n = () => ({ t, ...useContext(I1nContext) });

用法:

const { t, setLocale } = useI1n();

return (
  <div>
    <h1>{t("auth.title", { user: "Fran" })}</h1>
    <button onClick={() => setLocale("es_es")}>Español</button>
  </div>
);

非 JS 平台

Flutter、Android 和 iOS 项目不使用 SDK。它们使用 i1n pull 生成的翻译文件(.arb.xml.strings)及其原生本地化系统。


🛡️ 开发者体验

🔒 隐私与安全

  • 自动忽略i1n init 会自动将敏感配置文件添加到你的 .gitignore 中。

  • 密钥管理:API 密钥仅存储在本地,绝不会提交到版本控制系统。

  • 加密传输:所有同步操作均通过安全的 HTTPS 通道进行。

🔒 零配置类型安全 (TypeScript)

CLI 会生成一个轻量级的声明文件 (i1n.d.ts),自动使用你项目特定的键值增强 i1n 包。

  1. 拉取:运行 i1n pull。CLI 会生成 locales/i1n.d.ts自动更新你的 tsconfig.json,以便你的 IDE 立即找到它们。

  2. 使用:从 i1n 导入 t,即可获得完整的自动补全 + 编译时检查。无需手动路径映射。

import { t } from "i1n";

// Full autocomplete & compile-time checking
t("auth.login.title");

// ERROR: Argument of type '"auth.login.titlse"' is not assignable...
t("auth.login.titlse");

// Dynamic strings still pass through — useful for `t(item.name)`,
// runtime-built keys, etc.
declare const dynamicKey: string;
t(dynamicKey);

严格字面量检查已在 1.3.0 版本中引入:传递不在 I1nKeys 中的硬编码字符串现在会触发 TypeScript 错误(不再有运行时静默的 [i1n] Missing translation 警告)。类型为 string 的变量无需转换即可继续工作。


💳 定价

套餐

价格

键值

语言

AI 翻译/月

入门版

$0

600

2

2,000

专业版

$19/月

5,000

5

10,000

商业版

$49/月

15,000

12

20,000

企业版

自定义

自定义

182

自定义

CLI、SDK 和 MCP 服务器在所有套餐中均免费。入门版无需信用卡。

专业版终身使用权 99 美元起 — 仅限前 200 名用户


📄 许可证

MIT — © 2026 i1n.ai

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    AI-powered translation management built for AI agents. Automate localization with regional sensitivity and zero TMS overhead. Works with Claude Code, Cursor, VS Code via MCP protocol. Supports JSON, YAML, Markdown, PO and more.
    13
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    MCP server for managing i18n translation files — gives your AI agent full control over your app's translations without dumping entire locale files into context.
    18
    251
    11
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Pakvothe/i1n-cli'

If you have feedback or need assistance with the MCP directory API, please join our Discord server