docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거

Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
Antigravity Agent
2026-07-05 00:33:48 +09:00
parent 1cfd3bbb56
commit 9148c358d0
6455 changed files with 1 additions and 86875 deletions
@@ -0,0 +1,154 @@
---
id: frontend-i18n-patterns
title: i18n — 번역 / 복수형 / RTL / ICU
category: Coding
status: draft
source_trust_level: B
verification_status: conceptual
created_at: 2026-05-09
updated_at: 2026-05-09
tags: [frontend, i18n, l10n, react, vibe-coding]
tech_stack: { language: "TS / React / i18next / FormatJS", applicable_to: ["Web", "Mobile"] }
applied_in: []
aliases: [internationalization, localization, ICU MessageFormat, RTL, plural rules]
---
# i18n
> "1 item / 5 items" 가 모든 언어에 통하지 않음 (러시아어 1/2-4/5+, 아랍어 0/1/2/few/many/other). **ICU MessageFormat** 표준. `react-i18next` / `react-intl` (FormatJS) / `lingui`.
## 📖 핵심 개념
- ICU MessageFormat: `{count, plural, one {# item} other {# items}}`.
- Locale = 언어+지역 (`en-US`, `pt-BR`).
- RTL: 아랍어/히브리어 — 화면 좌우 반전.
- Lazy loading: 큰 번역 파일은 lang 별로 로딩.
## 💻 코드 패턴
### react-i18next
```ts
// i18n.ts
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import HttpBackend from 'i18next-http-backend';
i18n.use(HttpBackend).use(initReactI18next).init({
fallbackLng: 'en',
supportedLngs: ['en', 'ko', 'ja', 'ar'],
interpolation: { escapeValue: false }, // React 자체 escape
backend: { loadPath: '/locales/{{lng}}/{{ns}}.json' },
});
```
```ts
// public/locales/en/common.json
{
"greeting": "Hello, {{name}}",
"items": "{count, plural, one {# item} other {# items}}",
"lastSeen": "Last seen {date, date, medium}"
}
```
```tsx
import { useTranslation } from 'react-i18next';
function Hello({ name, count }: { name: string; count: number }) {
const { t } = useTranslation();
return <p>{t('greeting', { name })}: {t('items', { count })}</p>;
}
```
### FormatJS / react-intl
```tsx
import { FormattedMessage, useIntl } from 'react-intl';
<FormattedMessage
id="cart.items"
defaultMessage="{count, plural, one {# item} other {# items}}"
values={{ count: 3 }}
/>
```
### Lingui (compile-time, 작은 bundle)
```tsx
import { Trans, t } from '@lingui/macro';
<Trans>Hello {name}</Trans>;
const msg = t`You have ${n} items`;
// macro 가 build 시 catalog 추출
```
### 날짜 / 숫자
```ts
new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(1234.5);
// $1,234.50
new Intl.DateTimeFormat('ko-KR', { dateStyle: 'medium' }).format(new Date());
// 2026. 5. 9.
new Intl.RelativeTimeFormat('en').format(-3, 'day'); // 3 days ago
new Intl.ListFormat('en').format(['A', 'B', 'C']); // A, B, and C
```
### RTL
```tsx
import { useTranslation } from 'react-i18next';
const { i18n } = useTranslation();
const dir = i18n.dir(); // 'rtl' | 'ltr'
return <html dir={dir}>...</html>;
```
```css
/* logical properties (RTL 자동) */
.box { padding-inline-start: 1rem; } /* LTR=left, RTL=right */
.icon { margin-inline-end: 0.5rem; }
```
### 복수형 cases
```
{count, plural,
=0 {No items}
one {One item}
few {# items} // 슬라브 언어 등
many {# items} // 러시아어 등
other {# items}}
```
### Type-safe key
```ts
import type { TFunction } from 'i18next';
type Keys = 'greeting' | 'items' | 'lastSeen';
type SafeT = (k: Keys, opts?: Record<string, unknown>) => string;
```
또는 i18next-typescript / typesafe-i18n 사용.
## 🤔 의사결정 기준
| 상황 | 추천 |
|---|---|
| Next.js 프로젝트 | next-intl 또는 next-i18next |
| 가벼운 / 작은 앱 | i18next |
| 강력 type 안전 + 작은 bundle | Lingui |
| Apple 표준 | Apple FormatJS / NSLocalizedString |
| Plural / gender / select 복잡 | ICU MessageFormat 필수 |
| Translation memory | Crowdin / Lokalise / Phrase |
## ❌ 안티패턴
- **문장 concat**: "Hello " + name + "!" — 문장 순서가 언어마다 다름.
- **숫자 + 단위 직접 결합**: ICU plural.
- **Hard-coded date format**: Intl.DateTimeFormat.
- **`px` margin 으로 RTL 깨짐**: logical properties.
- **번역 미완료 = `{key}` 노출**: fallback + 자동화 (Lokalise PR).
- **런타임 detection 만**: SSR 시 UA / Accept-Language.
- **모든 언어 한 번에 로드**: lazy load lang별.
## 🤖 LLM 활용 힌트
- ICU MessageFormat 강력 권장.
- Intl API 표준 (NumberFormat, DateTimeFormat, RelativeTimeFormat).
- RTL = `dir` + logical properties.
## 🔗 관련 문서
- [[Frontend_A11y_Testing]]