키 잠금

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는:

  1. 구성에서 잠긴 키를 식별합니다
  2. 번역에서 해당 키를 제외합니다 — 잠긴 콘텐츠는 AI 모델로 전송되지 않습니다
  3. 소스 값을 모든 대상 파일에 직접 복사합니다
  4. 모든 언어에서 일관성을 유지합니다

워크플로우 예시:

// locales/en.json (소스)
{
  "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 (생성됨)
{
  "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"
  ]
}

이 표기법은 복잡한 중첩 구조에서도 작동합니다:

// 소스 구조
{
  "system": {
    "engine": {
      "component": "Lingo.dev Engine"
    }
  }
}

경로 system/engine/component는 컴포넌트 이름 값을 잠급니다.

점이 있는 키

슬래시 표기법은 이름에 점이 포함된 키를 처리합니다:

// 점이 있는 키 이름이 포함된 소스
{
  "modules": {
    "ai.translation": "AI 번역",
    "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"]
    }
  }
}

각 버킷 유형은 콘텐츠 구조에 따라 자체적인 잠긴 키 목록을 유지합니다.