Back to Skills

i18n

LobeHub i18n with react-i18next. Use for user-facing strings, locale keys, namespaces, useTranslation, t(), interpolation, zh-CN/en-US previews, hardcoded UI copy, or pnpm i18n.

79,602stars15,565forksUpdated 7/8/2026

Security Assessment

Safe(100/100)
Security Score100/100

About i18n

i18n is LobeHub's internationalization guide for adding and managing user-facing strings with react-i18next, where English (en-US) is the default language. The central rule is that translation source lives only in src/locales/default/: keys are added to the relevant {namespace}.ts file and new namespaces are exported from the default index, while the generated JSON files under locales/ are never edited by hand. Translations are produced by running pnpm i18n, but because that command is very slow, the guidance is to remind the user to run it before opening a PR rather than running it directly.

Keys follow a flat, dot-notation convention shaped as {feature}.{context}.{action|status}, for example sync.status.ready, rather than nested objects, and interpolated values use the {{variableName}} syntax. The guide also warns about key conflicts, such as a key that is both a leaf value and a parent path, and shows how to resolve them by introducing an explicit action segment.

Apply it whenever touching hardcoded UI copy, locale keys, namespaces, useTranslation, t() calls, interpolation, or zh-CN and en-US previews. Usage examples cover pulling t from a single namespace with useTranslation('common'), passing parameters into t(), and loading multiple namespaces with prefixed keys like t('common:save'). Common namespaces include common for shared UI, chat for chat features, and setting for settings, alongside many feature-specific ones such as auth, discover, editor, and models. Because the skill is marked not user-invocable, it is meant to guide translation work rather than be called directly.

FAQ

Which files should I edit for translations?

Only files in src/locales/default/ (the TypeScript source of truth). Never edit the generated JSON files under locales/.

What key-naming convention does LobeHub use?

Flat keys with dot notation following {feature}.{context}.{action|status}, not nested objects, with interpolated parameters written as {{variableName}}.

How are translations generated?

By running pnpm i18n, but the skill says to remind the user to run it before creating a PR rather than running it yourself, because it is very slow.

What framework and default language does it assume?

react-i18next, with English (en-US) as the default language.

How do I use a translated string in a component?

Import useTranslation, get t from a namespace such as useTranslation('common'), then call t('key') or t('key', { param }); multiple namespaces are supported with prefixed keys like t('common:save').

Install i18n

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill

Repository

lobehub/lobehub