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

v1.0.0

이 스킬 정보

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

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.

이 스킬을 사용하는 이유

t() 함수를 사용하여 에이전트가 무결점 국제화를 수행할 수 있는 능력을 부여하고 JSON 번들을 대상으로 해시 기반 조회를 생성하며 Babel 플러그인을 사용하여 자동 런타임 선택을 수행하며 JSON 등의 프로토콜을 사용하는 서버 및 클라이언트 구성 요소를 지원합니다.

최적의 용도

t() 함수를 사용하여 고급 인라인 번역 기능이 필요한 다국어 에이전트에게 적합합니다.

실행 가능한 사용 사례 for i18n-patterns

t() 함수를 사용하여 인라인 콘텐츠 번역을 수행하여 다국어 지원
효율적인 번역 검색을 위해 해시 기반 조회를 생성
Babel 플러그인을 사용하여 자동 런타임 선택을 수행하여 서버 및 클라이언트 구성 요소를 지원

! 보안 및 제한 사항

  • 컴파일 시 변환에 Babel 플러그인이 필요
  • 번역 데이터 저장에 JSON 번들로 제한

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?

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: t() 함수를 사용하여 인라인 콘텐츠 번역을 수행하여 다국어 지원, 효율적인 번역 검색을 위해 해시 기반 조회를 생성, 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?

컴파일 시 변환에 Babel 플러그인이 필요. 번역 데이터 저장에 JSON 번들로 제한.

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

관련 스킬

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

모두 보기

openclaw-release-maintainer

Logo of openclaw
openclaw

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

333.8k
0
인공지능

widget-generator

Logo of f
f

prompts.chat 피드 시스템을 위한 사용자 지정 가능한 위젯 플러그인을 생성합니다

149.6k
0
인공지능

flags

Logo of vercel
vercel

리액트 프레임워크

138.4k
0
브라우저

pr-review

Logo of pytorch
pytorch

파이썬에서 텐서와 동적 신경망 구현 및 강력한 GPU 가속 지원

98.6k
0
개발자