| ํญ๋ชฉ | ๋ด์ฉ |
| Invoke | /i18n |
| Aliases | /i18n:add, /translate, /locale |
| Category | petmedi-development |
| Complexity | moderate |
| MCP Servers | serena, context7 |
/i18n#
Context Framework Note: Activated for internationalization and multilingual support tasks.
Triggers#
- When adding new translation keys
- When managing multilingual text
- When using
context.t.* 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/
โโโ translations/
โ โโโ strings.i18n.yaml # Base (Korean)
โ โโโ strings_en.i18n.yaml # English
โโโ src/
โโโ translations/
โโโ translations.g.dart # Generated code
Basic Structure#
# shared/i10n/lib/translations/strings.i18n.yaml
common:
appName: ํซ๋ฉ๋
ok: ํ์ธ
cancel: ์ทจ์
save: ์ ์ฅ
loading: ๋ก๋ฉ ์ค...
error: ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค
auth:
login: ๋ก๊ทธ์ธ
logout: ๋ก๊ทธ์์
signUp: ํ์๊ฐ์
email: ์ด๋ฉ์ผ
password: ๋น๋ฐ๋ฒํธ
Placeholders#
user:
greeting: ' $name๋, ์๋
ํ์ธ์! '
points: ' $count ํฌ์ธํธ ๋ณด์ '
joinDate: ' $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
Text(context.t.common.appName)
Text(context.t.auth.login)
Text(context.t.home.title)
Placeholders#
Text(context.t.user.greeting(name: user.name))
Text(context.t.user.points(count: user.points.toString()))
Pluralization#
Text(context.t.items.count(n: itemCount))
Text(context.t.messages.unread(count: unreadCount))
Commands#
# Generate translation code
melos run generate:locale
# GPT auto-translation (English)
melos run generate:locale:gpt
# Check for missing translations
dart run slang analyze
Core Rules#
Naming Conventions#
- Use nested structures:
user.profile.title
- Use camelCase
- 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.newFeature --ko " ์๋ก์ด ๊ธฐ๋ฅ " --en " New Feature "
Add Plural Translation#
/i18n add cart.itemCount --ko " ์ํ " --en " item " --plural
Check Missing Translations#
References#
- Detailed implementation:
.claude/agents/i18n.md
- Translation files:
shared/i10n/lib/translations/