LogoCocode Skills

i18n

slang 기반 국제화(i18n) 번역 관리

항목내용
Invoke/i18n
Aliases/i18n:add, /translate, /locale
Categorypetmedi-development
Complexitymoderate
MCP Serversserena, context7

/i18n#

Context Framework Note: 국제화 및 다국어 지원 작업 시 활성화됩니다.

Triggers#

  • 새로운 번역 키 추가 시
  • 다국어 텍스트 관리 시
  • context.t.* 패턴 사용 시

Context Trigger Pattern#

/i18n {action} {key_path} [--options]

Parameters#

파라미터필수설명예시
action 수행할 작업 add, update, check
key_path 번역 키 경로 home.welcome, auth.login
--ko한국어 텍스트"환영합니다"
--en영어 텍스트"Welcome"
--plural복수형 처리true

File Structure#

shared/i10n/lib/
├── translations/
│   ├── strings.i18n.yaml      # 기본 (한국어)
│   └── strings_en.i18n.yaml   # 영어
└── src/
    └── translations/
        └── translations.g.dart # 생성된 코드

Translation File Format#

기본 구조#

# shared/i10n/lib/translations/strings.i18n.yaml
common:
  appName: 펫메디
  ok: 확인
  cancel: 취소
  save: 저장
  loading: 로딩 중...
  error: 오류가 발생했습니다

auth:
  login: 로그인
  logout: 로그아웃
  signUp: 회원가입
  email: 이메일
  password: 비밀번호

플레이스홀더#

user:
  greeting: '$name님, 안녕하세요!'
  points: '$count 포인트 보유'
  joinDate: '$date에 가입'

복수형#

items:
  count(param=n):
    zero: 항목 없음
    one: 항목 1개
    other: 항목 $n개

messages:
  unread(param=count):
    zero: 읽지 않은 메시지 없음
    one: 읽지 않은 메시지 1개
    other: 읽지 않은 메시지 $count개

컨텍스트 기반#

pet:
  type(context=PetType):
    dog: 강아지
    cat: 고양이
    bird: 새

Code Usage#

기본 사용#

// BuildContext 확장 사용
Text(context.t.common.appName)
Text(context.t.auth.login)
Text(context.t.home.title)

플레이스홀더#

Text(context.t.user.greeting(name: user.name))
Text(context.t.user.points(count: user.points.toString()))

복수형#

Text(context.t.items.count(n: itemCount))
Text(context.t.messages.unread(count: unreadCount))

Commands#

# 번역 코드 생성
melos run generate:locale

# GPT 자동 번역 (영어)
melos run generate:locale:gpt

# 누락된 번역 확인
dart run slang analyze

핵심 규칙#

네이밍 컨벤션#

  • 중첩 구조 사용 권장 (user.profile.title)
  • camelCase 사용
  • 의미 있는 키 이름

번역 규칙#

  • 모든 UI 텍스트는 번역 키 사용
  • 하드코딩 문자열 금지
  • 복수형은 항상 처리

코드 생성#

  • 번역 파일 수정 후 반드시 melos run generate:locale 실행
  • 생성된 코드 직접 수정 금지

MCP Integration#

단계MCP 서버용도
패턴 분석Context7slang 문서
코드 검색Serena기존 번역 패턴 참조

Examples#

새 번역 추가#

/i18n add home.newFeature --ko "새로운 기능" --en "New Feature"

복수형 번역 추가#

/i18n add cart.itemCount --ko "상품" --en "item" --plural

누락 번역 확인#

/i18n check

참조#

  • 상세 구현: .claude/agents/i18n.md
  • 번역 파일: shared/i10n/lib/translations/