i18n-patterns — personal-website i18n-patterns, shiqingqi.com, community, personal-website, ide skills, resume, typescript

v1.0.0

À propos de ce Skill

Parfait pour les agents multilingues ayant besoin de capacités de traduction avancées en ligne utilisant la fonction t() Internationalization (i18n) patterns using inline t() calls with compile-time Babel transformation. Use when adding or modifying translated text, working with locales, creating new pages or components that need translations, using the t() function, mentioning i18n, translations, locale switching, useLocale, setLocale, or when the user asks about how translations work in this project. Also use when working with the i18n codegen pipeline, Babel plugin, or generated translation bundles.

# Core Topics

QingqiShi QingqiShi
[4]
[1]
Updated: 3/22/2026

Killer-Skills Review

Decision support comes first. Repository text comes second.

Reference-Only Page Review Score: 7/11

This page remains useful for operators, but Killer-Skills treats it as reference material instead of a primary organic landing page.

Original recommendation layer Concrete use-case guidance Explicit limitations and caution
Review Score
7/11
Quality Score
36
Canonical Locale
en
Detected Body Locale
en

Parfait pour les agents multilingues ayant besoin de capacités de traduction avancées en ligne utilisant la fonction t() Internationalization (i18n) patterns using inline t() calls with compile-time Babel transformation. Use when adding or modifying translated text, working with locales, creating new pages or components that need translations, using the t() function, mentioning i18n, translations, locale switching, useLocale, setLocale, or when the user asks about how translations work in this project. Also use when working with the i18n codegen pipeline, Babel plugin, or generated translation bundles.

Pourquoi utiliser cette compétence

Permet aux agents de réaliser une internationalisation transparente en utilisant la fonction t(), en générant des recherches basées sur le hash contre des bundles JSON et en exploitant les plugins Babel pour la sélection automatique à l'exécution, prenant en charge les composants serveur et client avec des protocoles tels que JSON

Meilleur pour

Parfait pour les agents multilingues ayant besoin de capacités de traduction avancées en ligne utilisant la fonction t()

Cas d'utilisation exploitables for i18n-patterns

Traduire le contenu en ligne en utilisant la fonction t() pour le support multilingue
Générer des recherches basées sur le hash pour une récupération de traductions efficace
Automatiser la sélection à l'exécution pour les composants serveur et client en utilisant des plugins Babel

! Sécurité et Limitations

  • Nécessite un plugin Babel pour les transformations en temps de compilation
  • Limité aux bundles JSON pour le stockage des données de traduction

Why this page is reference-only

  • - Current locale does not satisfy the locale-governance contract.
  • - The underlying skill quality score is below the review floor.

Source Boundary

The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.

After The Review

Decide The Next Action Before You Keep Reading Repository Material

Killer-Skills should not stop at opening repository instructions. It should help you decide whether to install this skill, when to cross-check against trusted collections, and when to move into workflow rollout.

Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is i18n-patterns?

Parfait pour les agents multilingues ayant besoin de capacités de traduction avancées en ligne utilisant la fonction t() Internationalization (i18n) patterns using inline t() calls with compile-time Babel transformation. Use when adding or modifying translated text, working with locales, creating new pages or components that need translations, using the t() function, mentioning i18n, translations, locale switching, useLocale, setLocale, or when the user asks about how translations work in this project. Also use when working with the i18n codegen pipeline, Babel plugin, or generated translation bundles.

How do I install i18n-patterns?

Run the command: npx killer-skills add QingqiShi/shiqingqi.com/i18n-patterns. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for i18n-patterns?

Key use cases include: Traduire le contenu en ligne en utilisant la fonction t() pour le support multilingue, Générer des recherches basées sur le hash pour une récupération de traductions efficace, Automatiser la sélection à l'exécution pour les composants serveur et client en utilisant des plugins Babel.

Which IDEs are compatible with i18n-patterns?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for i18n-patterns?

Nécessite un plugin Babel pour les transformations en temps de compilation. Limité aux bundles JSON pour le stockage des données de traduction.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add QingqiShi/shiqingqi.com/i18n-patterns. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use i18n-patterns immediately in the current project.

! Reference-Only Mode

This page remains useful for installation and reference, but Killer-Skills no longer treats it as a primary indexable landing page. Read the review above before relying on the upstream repository instructions.

Upstream Repository Material

The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.

Upstream Source

i18n-patterns

Install i18n-patterns, an AI agent skill for AI agent workflows and automation. Review the use cases, limitations, and setup path before rollout.

SKILL.md
Readonly
Upstream Repository Material
The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.
Supporting Evidence

Internationalization (i18n)

How It Works

Translations are written inline using the t() function. A Babel plugin transforms these calls at compile time into hash-based lookups against generated JSON bundles. The same t() API works in both server and client components — the Babel plugin selects the correct runtime automatically.

Source: t({ en: "Hello", zh: "你好" })
  ↓ Babel plugin
Server: __i18n_lookup("a8cfb50c")   — reads from server JSON bundle
Client: useI18nLookup("a8cfb50c")  — reads from React context (hook)

Supported Locales

  • en — English
  • zh — Chinese

Defined as SupportedLocale in src/types.ts. Routes use [locale] parameter: /en/about, /zh/about.

The t() Function

Import from #src/i18n.ts. Pass an object with en and zh string literal properties:

tsx
1import { t } from "#src/i18n.ts"; 2 3// Plain text 4t({ en: "Hello", zh: "你好" }); 5 6// With HTML markup — returns ReactNode instead of string 7t( 8 { en: "<strong>Bold text</strong>", zh: "<strong>粗体文字</strong>" }, 9 { parse: true }, 10);

Both en and zh values must be string literals — no variables, template literals, or expressions. The codegen and Babel plugin rely on statically extracting these at build time.

Supported HTML tags in { parse: true } mode: <strong>, <em>, <b>, <i>, <p>.

Server Components

Use t() directly. No special setup needed — the Babel plugin handles everything:

tsx
1import { t } from "#src/i18n.ts"; 2 3export default function Page() { 4 return <h1>{t({ en: "Welcome", zh: "欢迎" })}</h1>; 5}

For page files (page.tsx under [locale]), the Babel plugin auto-injects setLocale() at the top of the default export function. You do not need to manually call setLocale or accept params — the plugin makes the function async, reads params.locale, and calls setLocale(validateLocale(params.locale)) for you.

Layout files that need the locale for other purposes (e.g. generateMetadata, routing logic) should still read params manually since they have non-i18n reasons to do so.

Client Components

Use t() identically — the Babel plugin detects "use client" and swaps in client-specific lookup functions that read from React context:

tsx
1"use client"; 2 3import { t } from "#src/i18n.ts"; 4 5export function SearchButton() { 6 return <button>{t({ en: "Search", zh: "搜索" })}</button>; 7}

Client translations are provided automatically. The codegen generates a manifest mapping page/layout files to their client translation bundles. The Babel plugin reads this manifest and auto-wraps the default export's return value with <ClientTranslationsProvider>, so client components receive translations without any manual wiring.

Getting the Locale in Client Components

Use the useLocale() hook when you need the locale value itself (not for translations):

tsx
1"use client"; 2 3import { useLocale } from "#src/hooks/use-locale.ts"; 4 5export function LocaleAwareComponent() { 6 const locale = useLocale(); 7 const formatter = new Intl.NumberFormat(locale); 8 return <span>{formatter.format(1234)}</span>; 9}

Generating Localized URLs

tsx
1import { getLocalePath } from "#src/utils/pathname.ts"; 2 3getLocalePath("/about", locale); // → "/en/about" or "/zh/about"

Build Pipeline

Codegen (pnpm codegen:i18n)

The codegen script in tooling/i18n-codegen/ does:

  1. Extracts all t() calls from source files via AST parsing
  2. Generates global JSON bundles: src/_generated/i18n/translations.{en,zh}.json
  3. Traces client component imports from each page/layout entry point
  4. Generates per-page client bundles: src/_generated/i18n/client/{name}.{en,zh}.json
  5. Generates loader modules: src/_generated/i18n/client-loaders/{name}.ts
  6. Generates manifest: src/_generated/i18n/manifest.json

Run codegen after adding/changing any t() call, or the Babel plugin won't find the translation key at runtime.

Babel Plugin (tooling/i18n-babel-plugin/)

Runs at compile time (both dev and build). Transforms:

  • t({en, zh})__i18n_lookup(key) (server) or useI18nLookup(key) (client)
  • t({en, zh}, { parse: true })__i18n_lookupParse(key) or useI18nLookupParse(key)
  • Auto-injects setLocale for page files with t() calls
  • Auto-wraps returns with <ClientTranslationsProvider> for manifest entries

Common Patterns

Adding Translations to a New Page

tsx
1// src/app/[locale]/my-page/page.tsx 2import { t } from "#src/i18n.ts"; 3 4export default function Page() { 5 return ( 6 <div> 7 <h1>{t({ en: "My Page", zh: "我的页面" })}</h1> 8 <p>{t({ en: "Some content", zh: "一些内容" })}</p> 9 </div> 10 ); 11}

Then run pnpm codegen:i18n to regenerate bundles.

Adding Translations to a Client Component

tsx
1// src/components/my-component.tsx 2"use client"; 3 4import { t } from "#src/i18n.ts"; 5 6export function MyComponent() { 7 return <span>{t({ en: "Click me", zh: "点击我" })}</span>; 8}

The parent page/layout must be in the manifest for client translations to work. Run pnpm codegen:i18n — the codegen traces imports and auto-generates the client bundle.

Rich Text with Markup

tsx
1{ 2 t( 3 { 4 en: "Read our <strong>terms of service</strong>", 5 zh: "阅读我们的<strong>服务条款</strong>", 6 }, 7 { parse: true }, 8 ); 9}

Common Mistakes

  • Using variables or template literals in t() — values must be string literals
  • Forgetting to run pnpm codegen:i18n after adding new t() calls
  • Manually adding setLocale to page files — the Babel plugin does this automatically
  • Creating separate translations.json files — translations live inline in the component
  • Using getTranslations() or useTranslations() — these no longer exist; use t() everywhere

Compétences associées

Looking for an alternative to i18n-patterns or another community skill for your workflow? Explore these related open-source skills.

Voir tout

openclaw-release-maintainer

Logo of openclaw
openclaw

Your own personal AI assistant. Any OS. Any Platform. The lobster way. 🦞

widget-generator

Logo of f
f

Générez des plugins de widgets personnalisables pour le système de flux prompts.chat

flags

Logo of vercel
vercel

Le Cadre de Réaction

138.4k
0
Navigateur

pr-review

Logo of pytorch
pytorch

Tenseurs et réseaux neuronaux dynamiques en Python avec une forte accélération GPU

98.6k
0
Développeur