ํ๋ฉด์ ๋ณด์ด๋ ๋ชจ๋ ๋ฌธ๊ตฌ(๋ฒํผ, ์๋ด ๋ฉ์์ง ๋ฑ)๋ฅผ ์ฌ๋ฌ ๋๋ผ ์ธ์ด๋ก ๋ฒ์ญํด ๊ด๋ฆฌํด ์ฃผ๋ ๋๊ตฌ์
๋๋ค.
ํ๊ตญ์ด๋ก ์ ์ ๋ฌธ์ฅ์ "์์ด๋ก๋ ์ด๋ ๊ฒ"๋ผ๊ณ ์ง์ ์ง์ด์ฃผ๋ฉด, ์ฑ์ด ์ฌ์ฉ์์ ์ธ์ด์ ๋ง์ถฐ ์์์ ๋ณด์ฌ์ค๋๋ค. ๋จ์ด์ฅ์ ์ ๋จ์ด์ ๋ป์ ์ถ๊ฐํ๋ ๊ฒ๊ณผ ๋น์ทํด์.
โ๏ธ ์์ธ ์ต์
ยท์คํ ๋ช
์ธ (๊ฐ๋ฐ์ / AI ์์ด์ ํธ์ฉ)
Triggers#
- When adding new translation keys
- When managing multilingual text
- When using
context.i10n.* patterns
Context Trigger Pattern#
/i18n {action} {key_path} [--options]
Parameters#
| Parameter | Required | Description | Example |
|---|
action | โ
| Action to perform | add, update, check |
key_path | โ
| Translation key path | home.welcome, auth.login |
--ko | โ | Korean text | "ํ์ํฉ๋๋ค" |
--en | โ | English text | "Welcome" |
--plural | โ | Pluralization handling | true |
File Structure#
shared/i10n/lib/src/
โโโ json/
โ โโโ ko.i18n.json # Base (Korean)
โ โโโ en.i18n.json # English
โ โโโ ... (ja, zh-Hans, de, fr, es, it, pt, ru, ar)
โโโ translations/
โโโ translations.g.dart # Generated code
Basic Structure#
// shared/i10n/lib/src/json/ko.i18n.json
{
" common " : {
" app_name " : " Unibook " ,
" ok " : " ํ์ธ " ,
" cancel " : " ์ทจ์ " ,
" save " : " ์ ์ฅ " ,
" loading " : " ๋ก๋ฉ ์ค... " ,
" error " : " ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค "
},
" auth " : {
" login " : " ๋ก๊ทธ์ธ " ,
" logout " : " ๋ก๊ทธ์์ " ,
" sign_up " : " ํ์๊ฐ์
" ,
" email " : " ์ด๋ฉ์ผ " ,
" password " : " ๋น๋ฐ๋ฒํธ "
}
}
Placeholders#
{
" user " : {
" greeting " : " {name}๋, ์๋
ํ์ธ์! " ,
" points " : " {count} ํฌ์ธํธ ๋ณด์ " ,
" join_date " : " {date}์ ๊ฐ์
"
}
}
Pluralization#
{
" items " : {
" count(param=n) " : {
" zero " : " ํญ๋ชฉ ์์ " ,
" one " : " ํญ๋ชฉ 1๊ฐ " ,
" other " : " ํญ๋ชฉ {n}๊ฐ "
}
},
" messages " : {
" unread(param=count) " : {
" zero " : " ์ฝ์ง ์์ ๋ฉ์์ง ์์ " ,
" one " : " ์ฝ์ง ์์ ๋ฉ์์ง 1๊ฐ " ,
" other " : " ์ฝ์ง ์์ ๋ฉ์์ง {count}๊ฐ "
}
}
}
Context-Based#
{
" pet " : {
" type(context=PetType) " : {
" dog " : " ๊ฐ์์ง " ,
" cat " : " ๊ณ ์์ด " ,
" bird " : " ์ "
}
}
}
Code Usage#
Basic Usage#
// Using BuildContext extension (provided by package:core)
Text(context.i10n.common.app_name)
Text(context.i10n.auth.login)
Text(context.i10n.home.title)
Placeholders#
Text(context.i10n.user.greeting(name: user.name))
Text(context.i10n.user.points(count: user.points.toString()))
Pluralization#
Text(context.i10n.items.count(n: itemCount))
Text(context.i10n.messages.unread(count: unreadCount))
Commands#
# Generate translation code
melos run generate:locale
# GPT auto-translation (English)
melos run translate:slang
# Check for missing translations
dart run slang analyze
Core Rules#
Naming Conventions#
- Use nested structures:
user.profile.title - Use snake_case (key_case: snake)
- Use meaningful key names
Translation Rules#
- All UI text must use translation keys
- Hard-coded strings are prohibited
- Pluralization must always be handled
Code Generation#
- Run
melos run generate:locale after modifying translation files - Do not manually edit generated code
MCP Integration#
| Step | MCP Server | Purpose |
|---|
| Pattern analysis | Context7 | slang documentation |
| Code search | Serena | Reference existing translation patterns |
Examples#
Add New Translation#
/i18n add home.new_feature --ko " ์๋ก์ด ๊ธฐ๋ฅ " --en " New Feature "
Add Plural Translation#
/i18n add cart.item_count --ko " ์ํ " --en " item " --plural
Check Missing Translations#
References#
- Detailed implementation:
.claude/agents/i18n.md - Translation files:
shared/i10n/lib/src/json/