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

v1.0.0

Sobre este Skill

Perfeito para Agentes Multilíngues que necessitam de capacidades de tradução avançadas em linha usando a função 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

Perfeito para Agentes Multilíngues que necessitam de capacidades de tradução avançadas em linha usando a função 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.

Por que usar essa habilidade

Habilita os agentes a realizar internacionalização sem interrupções usando a função t(), gerando pesquisas baseadas em hash contra pacotes JSON e aproveitando plugins Babel para seleção automática de tempo de execução, suportando componentes de servidor e cliente com protocolos como JSON

Melhor para

Perfeito para Agentes Multilíngues que necessitam de capacidades de tradução avançadas em linha usando a função t()

Casos de Uso Práticos for i18n-patterns

Traduzir conteúdo em linha usando a função t() para suporte multilíngue
Gerar pesquisas baseadas em hash para recuperação eficiente de traduções
Automatizar a seleção de tempo de execução para componentes de servidor e cliente usando plugins Babel

! Segurança e Limitações

  • Exige plugin Babel para transformações em tempo de compilação
  • Limitado a pacotes JSON para armazenamento de dados de tradução

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?

Perfeito para Agentes Multilíngues que necessitam de capacidades de tradução avançadas em linha usando a função 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: Traduzir conteúdo em linha usando a função t() para suporte multilíngue, Gerar pesquisas baseadas em hash para recuperação eficiente de traduções, Automatizar a seleção de tempo de execução para componentes de servidor e cliente usando 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?

Exige plugin Babel para transformações em tempo de compilação. Limitado a pacotes JSON para armazenamento de dados de tradução.

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

Habilidades Relacionadas

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

Ver tudo

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

Gerar plugins de widgets personalizáveis para o sistema de feed do prompts.chat

flags

Logo of vercel
vercel

O Framework React

138.4k
0
Navegador

pr-review

Logo of pytorch
pytorch

Tensors and Dynamic neural networks in Python with strong GPU acceleration

98.6k
0
Desenvolvedor