Communitygithub.com

국제화(i18n) 스킬

next-intl 및 react-i18next 패턴, 로케일 라우팅, 메시지 추출, 복수형 처리, RTL 지원, Intl API 형식화를 제공합니다.

국제화(i18n) 스킬란 무엇인가요?

이 스킬은 Next.js App Router 환경에서 `next-intl`을, React SPA 환경에서 `react-i18next`를 사용하여 애플리케이션을 국제화하는 방법을 정의합니다. Next.js에서는 `useTranslations()` 훅과 `NextIntlClientProvider`, 미들웨어를 통한 로케일 감지 패턴을 제공하며, React SPA에서는 `useTranslation()` 훅과 `i18next-http-backend`를 통한 지연 로딩 방식을 지원합니다. 로케일 인식 라우팅(`/en/about`, `/fr/about`)을 위해 미들웨어가 `Accept-Language` 헤더를 감지하고 리디렉션하며, 번역 파일은 로케일과 네임스페이스별로 JSON 파일로 분리해 필요한 것만 로드합니다. ICU 메시지 형식을 사용한 복수형 처리, `Intl.DateTimeFormat`과 `Intl.NumberFormat`을 통한 날짜/숫자/통화 형식화, CSS 논리 속성을 사용한 RTL 지원 등 현대적인 국제화 모범 사례를 포함하고 있어 개발자가 일관되고 확장 가능한 다국어 애플리케이션을 구축하는 데 도움을 줍니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/YepAPI/skills/tree/HEAD/skills/i18n

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

i18n

규칙

  • Next.js App Router: next-intl 사용 — useTranslations() 훅, NextIntlClientProvider, 로케일 감지를 위한 미들웨어
  • React SPA: react-i18next 사용 — useTranslation() 훅, 지연 로딩을 위한 i18next-http-backend를 포함한 i18n.init()
  • 로케일 인식 라우팅: /en/about, /fr/about — Accept-Language 헤더를 감지하고 리디렉션하는 미들웨어 사용
  • 번역 파일: 로케일 및 네임스페이스별 JSON 파일 — messages/en/common.json, messages/fr/common.json
  • 네임스페이스 분할: 기능/페이지당 하나의 네임스페이스 — auth.json, dashboard.json, settings.json — 페이지에 필요한 것만 로드
  • 복수형 처리: ICU 메시지 형식 사용 — {count, plural, one {# 개 항목} other {# 개 항목}}
  • 보간: t('greeting', { name }) — 번역된 문자열을 절대 연결하지 않음
  • 날짜/숫자/통화: Intl.DateTimeFormat, Intl.NumberFormat 사용 — 포맷을 하드코딩하지 않음
  • RTL 지원: <html>에 dir="rtl" 사용, CSS 논리 속성(margin-left 대신 margin-inline-start) 사용, 아랍어/히브리어로 테스트

패턴

// next-intl: middleware.ts
import createMiddleware from "next-intl/middleware";
export default createMiddleware({
  locales: ["en", "fr", "de", "ar"],
  defaultLocale: "en",
});

// next-intl: 컴포넌트 사용
import { useTranslations } from "next-intl";
function ProductCard({ price, date }: { price: number; date: Date }) {
  const t = useTranslations("products");
  const format = useFormatter();
  return (
    <div>
      <h2>{t("title")}</h2>
      <p>{format.number(price, { style: "currency", currency: "USD" })}</p>
      <p>{format.dateTime(date, { dateStyle: "medium" })}</p>
    </div>
  );
}

피해야 할 것

  • 사용자 대상 문자열 하드코딩 — 모든 문자열은 반드시 t()를 통해 처리
  • 번역된 텍스트의 문자열 연결 — 보간 또는 ICU 형식 사용
  • 모든 로케일을 미리 로드 — 로케일 및 네임스페이스별로 지연 로딩
  • 레이아웃에 CSS left/right 사용 — RTL 호환성을 위해 논리 속성 사용
  • 로케일을 localStorage에만 저장 — SEO 및 공유 가능성을 위해 URL 기반 로케일 사용

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

YepAPI/skills

WCAG 2.1 AA — semantic HTML, keyboard navigation, screen readers.

YepAPI/skills

Experiment setup, variant splitting, statistical significance, and feature flag integration.

YepAPI/skills

CRUD generators, data tables, user management, role-based access, and bulk operations.

YepAPI/skills

Monitor what ChatGPT and Gemini say about your brand using YepAPI.

YepAPI/skills

Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.

YepAPI/skills

Commander.js, interactive prompts with Clack, spinners, colors, config files, exit codes, and npm publishing.

YepAPI/skills

cmdk integration, Cmd+K trigger, fuzzy search, grouped actions, keyboard navigation, and dynamic action registration.

YepAPI/skills

Content planning with trend and sentiment data from YepAPI.

YepAPI/skills

Content calendar, keyword-driven planning, and content briefs.

YepAPI/skills

Theme switching with CSS variables, system preference detection, next-themes, and persistence.

YepAPI/skills

Threaded comments, @mentions, reactions, moderation queue, optimistic UI, and cursor pagination.

YepAPI/skills

Competitive analysis between domains using YepAPI.

YepAPI/skills

Layout grids, KPI cards, data tables with sorting/filtering, sidebar navigation, and responsive breakpoints.

YepAPI/skills

Data encryption — TLS everywhere, AES-256-GCM for PII, bcrypt passwords, encrypted backups.

YepAPI/skills

Chart patterns with Recharts/Nivo/D3, responsive containers, color scales, and accessibility.

YepAPI/skills

Drizzle schema definition, push vs migrate, type-safe queries, relations, transactions, and prepared statements.

YepAPI/skills

Upload handling, resize/compress, CDN delivery, blur placeholders, and next/image patterns.

YepAPI/skills

Local business and Google Maps research using YepAPI.

YepAPI/skills

Cursor-based pagination, IntersectionObserver, virtualized lists with @tanstack/react-virtual, and scroll position restoration.

YepAPI/skills

Chat UI components, streaming responses with AI SDK, context window management, and RAG patterns.

관련 스킬