Skip to main content
Agent skill

I18n

Use for user-facing strings and react-i18next locale keys, namespaces, interpolation, translations or bun run i18n.

All install options
Quick install · Personal (~/.claude/skills)Project / Cursor / Desktop →
mkdir -p ~/.claude/skills/i18n && curl -fsSL 'https://raw.githubusercontent.com/lobehub/lobehub/canary/.agents/skills/i18n/SKILL.md' -o ~/.claude/skills/i18n/SKILL.md

Get the complete skill folder, including its scripts and reference files.

When to use this skill

Use I18n when an AI agent needs a reusable SKILL.md workflow for this job: Use for user-facing strings and react-i18next locale keys, namespaces, interpolation, translations or bun run i18n.

When not to use it

Skip I18n when the task is outside the writing category, or when a more specific skill in this directory already covers the same workflow with clearer triggers.

How to install

Where will you use it?

Install scope
One-line install (Claude Code)
mkdir -p ~/.claude/skills/i18n && curl -fsSL 'https://raw.githubusercontent.com/lobehub/lobehub/canary/.agents/skills/i18n/SKILL.md' -o ~/.claude/skills/i18n/SKILL.md
  1. Claude Code personal install: place the skill and its bundled files at ~/.claude/skills/i18n/SKILL.md. For a shared project, commit the folder at .claude/skills/i18n/ instead.
  2. Current Claude Code detects SKILL.md changes in watched directories during the session. If you just created a top-level skills directory, run /reload-skills. Check that the skill is listed before testing its trigger.
  3. For Claude chat or Cowork in the Desktop app, manage uploaded skills in Customize > Skills; copying files into a local Claude Code folder is not a Desktop install. Other agents may use different install locations.

Full install guide for Claude, Cursor, and Codex →

Try a starter prompt

After installing the skill, paste this starter prompt into your agent to verify it triggers on a small task.

Starter prompt
Use the I18n skill for this task: Add keys to packages/locales/src/default/{namespace}.ts. Confirm any required inputs or files before making changes.

What supports this recommendation?

81/100 provisional content score. This measures documentation, practical detail and source signals. It is not a measured task success rate or a security certification.

Documentation
86/100
Practical detail
92/100
Source evidence
63/100
Source signals
70/100
Model compatibility evidence
  • claudeuntested

    No model-specific signal or recorded compatibility test was found.

  • chatgptinferred

    The skill text mentions ChatGPT or a closely associated term. This is keyword-derived compatibility; no hands-on model test is recorded.

  • geminiuntested

    No model-specific signal or recorded compatibility test was found.

  • copilotuntested

    No model-specific signal or recorded compatibility test was found.

  • llamauntested

    No model-specific signal or recorded compatibility test was found.

  • perplexityuntested

    No model-specific signal or recorded compatibility test was found.

  • mistraluntested

    No model-specific signal or recorded compatibility test was found.

  • grokuntested

    No model-specific signal or recorded compatibility test was found.

Inferred compatibility is based on content signals. Check the app, its available tools and setup requirements before running a skill.

What this skill does

# LobeHub Internationalization Guide

- Default language: English (en-US) - Framework: react-i18next - **Only edit files in `packages/locales/src/default/`** - Never hand-write translations in `locales/` JSON (except en-US/zh-CN previews); generated locales change only through `lobe-i18n`, plus the key deletions described in [Changing an existing key's English text](#changing-an-existing-keys-english-text) - Leave generated locales to the daily `auto-i18n.yml` workflow by default; run `bun run i18n` manually only when they are needed immediately

## Key Naming Convention

**Flat keys with dot notation** (not nested objects):

```typescript // ✅ Correct export default { 'alert.cloud.action': '立即体验', 'sync.actions.sync': '立即同步', 'sync.status.ready': '已连接', };

// ❌ Avoid nested objects export default { alert: { cloud: { action: '...' } }, }; ```

**Patterns:** `{feature}.{context}.{action|status}`

**Parameters:** Use `{{variableName}}` syntax

```typescript 'alert.cloud.desc': '我们提供 {{credit}} 额度积分', ```

**Avoid key conflicts:**

```typescript // ❌ Conflict 'clientDB.solve': '自助解决', 'clientDB.solve.backup.title': '数据备份',

// ✅ Solution 'clientDB.solve.action': '自助解决', 'clientDB.solve.backup.title': '数据备份', ```

## Workflow

1. Add keys to `packages/locales/src/default/{namespace}.ts` 2. Export new namespace in `packages/locales/src/default/index.ts` 3. For dev preview: manually translate `locales/zh-CN/{namespace}.json` and `locales/en-US/{namespace}.json` 4. Leave all other locales to `.github/workflows/auto-i18n.yml`, which runs daily and opens an automated translation PR 5. Run `bun run i18n` manually only when the branch needs those translations immediately; it is slow and requires `OPENAI_API_KEY`

### Changing an existing key's English text

`lobe-i18n` (both the daily workflow and `bun run i18n`) only translates keys that are **missing** from a locale. It never re-translates a key whose English value changed, so editing an existing value leaves every generated locale on the old text indefinitely (e.g. expanded `settingsSearch.tabKeywords.*` stayed stale in 16 locales for weeks).

When a change alters an existing key's meaning or content (not just a typo), do one of:

- Rename the key, so it is missing everywhere and gets translated fresh. - Re-translate it in the same PR: delete the key from every generated `locales/*/{namespace}.json` (all except en-US/zh-CN), run `bun run i18n`, and commit **only** those keys — the run also fills unrelated missing keys, which belong to the daily workflow PR. - If the stale translation is harmless until the daily run, delete the key from the generated locales so they fall back to English and the workflow re-translates it. Do not do this when the localized text is load-bearing (e.g. search keywords users type in their own language).

## Usage

```tsx import { useTranslation } from 'react-i18next';

const { t } = useTranslation('common');

t('newFeature.title'); t('alert.cloud.desc', { credit: '1000' });

// Multiple namespaces const { t } = useTranslation(['common', 'chat']); t('common:save'); ```

## Common Namespaces

**Most used:** `common` (shared UI), `chat` (chat features), `setting` (settings)

Others: auth, changelog, components, discover, editor, electron, error, file, hotkey, knowledgeBase, memory, models, plugin, portal, providers, tool, topic

Intended uses

  • Add keys to packages/locales/src/default/{namespace}.ts
  • Export new namespace in packages/locales/src/default/index.ts
  • For dev preview: manually translate locales/zh-CN/{namespace}.json and locales/en-US/{namespace}.json
  • Leave all other locales to .github/workflows/auto-i18n.yml, which runs daily and opens an automated translation PR
  • Run bun run i18n manually only when the branch needs those translations immediately; it is slow and requires OPENAIAPIKEY

Implementation notes

  • Review the source instructions and adapt inputs before running the workflow.

Try it, then tell us how it went

A copied prompt does not tell us whether the task worked. Report your result after checking the output. We collect your tool and outcome, never your files or prompt.