i18n

Convert user-facing strings into react-i18next translation keys and namespace mappings.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/kingheu0818-sketch/lobehub_yu --skill i18n-kingheu0818-sketch
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: i18n
Source: https://github.com/kingheu0818-sketch/lobehub_yu/tree/main/.agents/skills/i18n
Command: npx skills add https://github.com/kingheu0818-sketch/lobehub_yu --skill i18n-kingheu0818-sketch

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents inconsistent or hardcoded UI text by guiding you to add internationalization keys and translations in LobeHub’s react-i18next setup, so every user-facing string can be discovered and translated reliably.

Core Features & Use Cases

  • Key creation and naming: Enforces a flat dot-notation key pattern like {feature}.{context}.{action} to avoid collisions and keep translations maintainable.
  • Namespace wiring: Helps you register new namespaces in src/locales/default/index.ts so t() calls resolve correctly across features.
  • Translation workflow: Supports both automated generation via pnpm i18n and manual zh-CN/en-US updates for dev preview without touching the wrong files.

Quick Start

Add your new user-facing string by creating a new flat dot-notated key under src/locales/default/{namespace}.ts, then translate the corresponding zh-CN/en-US JSON for dev preview or run pnpm i18n before opening a PR.

Frequently Asked Questions about i18n

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add react-i18next translation keys without hardcoding UI text?▼

To add react-i18next translation keys without hardcoding UI text, create a new flat dot-notated key like `{feature}.{context}.{action}` in `src/locales/default/{namespace}.ts` and wire the namespace in the index file.

How does the pnpm i18n command handle zh-CN and en-US translation files?▼

The `pnpm i18n` command automatically generates translation files by extracting keys from the default locale definitions, ensuring zh-CN and en-US JSON files stay synchronized for development preview or release workflows.

What is the flat dot-notation key convention for react-i18next namespaces?▼

The flat dot-notation key convention for react-i18next namespaces structures keys as `{feature}.{context}.{action}` to prevent translation key collisions and keep locale mappings maintainable across feature development.

How do I wire a new namespace in the default locale index for react-i18next?▼

To wire a new namespace in the default locale index, register it in `src/locales/default/index.ts` so `t()` calls resolve correctly across features without directly modifying the source JSON files.

Can I use variable interpolation in translation keys with {{variable}} syntax?▼

Yes, you can use variable interpolation in translation keys by applying the `{{variable}}` syntax within your locale string definitions, allowing dynamic values to be injected into the translated text at runtime.

Why does pnpm i18n modify locale files instead of editing source JSON directly?▼

The `pnpm i18n` workflow modifies locale TypeScript definitions rather than editing source JSON files directly to maintain a single source of truth and prevent translation desynchronization during development or PR preparation.