키 잠금
Lingo.dev CLI를 사용하면 특정 번역 키를 잠가서 모든 언어에서 동일한 값을 유지할 수 있습니다. 키를 잠그면 CLI는 번역 처리에서 해당 키를 제외하고 소스 값을 모든 대상 파일에 직접 복사합니다.
키 잠금 설정
i18n.json의 버킷 구성에 lockedKeys를 추가하세요:
{
"locale": {
"source": "en",
"targets": ["es", "fr", "de"]
},
"buckets": {
"json": {
"include": ["locales/[locale].json"],
"lockedKeys": ["system/component", "config/engine", "modules/processor"]
}
}
}
lockedKeys 배열은 슬래시(/) 표기법을 사용하여 중첩된 키를 지정하고 별표(*)를 사용하여 여러 키를 매칭합니다.
키 잠금 작동 방식
번역 처리 중 Lingo.dev CLI는:
- 잠긴 키 식별 — 구성에서 잠긴 키를 찾습니다
- 번역에서 제외 — 잠긴 콘텐츠는 AI 모델로 전송되지 않습니다
- 소스 값 복사 — 모든 대상 파일에 직접 복사합니다
- 일관성 유지 — 모든 언어에서 일관성을 유지합니다
예시 워크플로:
// locales/en.json (source)
{
"welcome": "Welcome to our platform",
"system": {
"component": "Lingo.dev CLI",
"processor": "Translation Engine"
},
"config": {
"engine": "Lingo.dev Engine"
}
}
잠긴 키 구성 사용:
{
"lockedKeys": ["system/component", "system/processor", "config/engine"]
}
생성된 스페인어 번역:
// locales/es.json (generated)
{
"welcome": "Bienvenido a nuestra plataforma",
"system": {
"component": "Lingo.dev CLI",
"processor": "Translation Engine"
},
"config": {
"engine": "Lingo.dev Engine"
}
}
welcome만 번역되고 잠긴 키는 소스와 동일하게 유지됩니다.
키 잠금이 없으면 "Lingo.dev Engine"이 스페인어로 "Motor de Lingo.dev" 또는 일본어로 "Lingo.devエンジン"으로 잘못 번역될 수 있으며, 이 예시에서는 원하지 않는 결과입니다.
중첩 키 경로
슬래시(/) 표기법을 사용하여 모든 깊이의 키를 잠글 수 있습니다:
{
"lockedKeys": [
"system/engine/component",
"modules/ai/processor",
"config/translation/handler"
]
}
이 표기법은 복잡한 중첩 구조에서도 작동합니다:
// Source structure
{
"system": {
"engine": {
"component": "Lingo.dev Engine"
}
}
}
경로 system/engine/component는 컴포넌트 이름 값을 잠급니다.
점이 포함된 키
슬래시 표기법은 이름에 점이 포함된 키를 처리합니다:
// Source with dotted key names
{
"modules": {
"ai.translation": "AI Translation",
"content.processor": "Content Processor"
}
}
다음 명령으로 이 키들을 잠급니다:
{
"lockedKeys": ["modules/ai.translation", "modules/content.processor"]
}
여러 버킷 유형
파일 형식마다 서로 다른 잠금 키를 가질 수 있습니다:
{
"buckets": {
"json": {
"include": ["locales/[locale].json"],
"lockedKeys": ["config/engine", "system/component"]
},
"yaml": {
"include": ["translations/[locale].yml"],
"lockedKeys": ["service/name", "module/title"]
}
}
}
각 버킷 유형은 콘텐츠 구조에 따라 자체 잠금 키 목록을 유지합니다.
배열 값
배열 값을 가진 키의 경우, 키 이름 뒤에 /*를 추가합니다:
// Source file
{
"navigation": {
"menuItems": ["Home", "About", "Contact"],
"title": "Main Navigation"
}
}
다음 명령으로 배열을 잠급니다:
{
"lockedKeys": ["navigation/menuItems/*"]
}
결과:
// locales/es.json
{
"navigation": {
"menuItems": ["Home", "About", "Contact"],
"title": "Navegación Principal"
}
}