Lingo.dev + .po (Gettext)

Lingo.dev CLI는 msgid 참조, 메타데이터 및 gettext 특정 형식 규칙을 보존하면서 GNU gettext .po 파일을 번역합니다. CLI는 GNU gettext 사양을 정확히 따르며, xgettext, msgfmt 및 Poedit 도구와 함께 작동하고, 중의성 해소를 위한 msgctxt를 처리하며, 복잡한 복수형 규칙을 지원하고, 모든 번역자 및 빌드 정보를 보존합니다.

빠른 설정

gettext 포터블 오브젝트 파일 구성:

{
  "locale": {
    "source": "en",
    "targets": ["es", "fr", "de"]
  },
  "buckets": {
    "po": {
      "include": ["locale/[locale]/LC_MESSAGES/messages.po"]
    }
  }
}

주의사항: [locale]은 CLI 실행 중에 실제 로케일로 대체되므로 구성에 문자 그대로 남겨두어야 하는 플레이스홀더입니다.

PO 파일 번역

npx lingo.dev@latest i18n

msgstr 번역을 업데이트하는 동시에 msgid 참조, 번역자 주석 및 gettext 메타데이터를 보존합니다.

Gettext 구조 처리

기본 메시지 번역

#: src/main.c:42
msgid "Welcome to our application"
msgstr "Bienvenido a nuestra aplicación"

#: src/dialog.c:15
#, c-format
msgid "You have %d new messages"
msgstr "Tienes %d mensajes nuevos"

복수형

#: src/counter.c:28
msgid "One file selected"
msgid_plural "%d files selected"
msgstr[0] "Un archivo seleccionado"
msgstr[1] "%d archivos seleccionados"

컨텍스트 처리

#: src/menu.c:12
msgctxt "menu item"
msgid "File"
msgstr "Archivo"

#: src/toolbar.c:8
msgctxt "document type"
msgid "File"
msgstr "Fichero"

메타데이터 보존

PO 헤더 정보


# Translation file for MyApp

# Copyright (C) 2024 MyCompany

# This file is distributed under the same license as the MyApp package.

#
msgid ""

msgstr ""
"Project-Id-Version: MyApp 1.0\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-01-15 10:30+0000\n"
"Language: es\n"
"Content-Type: text/plain; charset=UTF-8\n"

모든 헤더 메타데이터와 번역자 주석이 정확히 보존됩니다.

주석 유형

  • 번역가 주석: # 이것은 컨텍스트가 필요합니다
  • 추출된 주석: #. 사용법에 대한 개발자 참고사항
  • 참조 주석: #: src/file.c:123
  • 플래그 주석: #, c-format, fuzzy

고급 구성

다중 도메인

"po": {
  "include": [
    "locale/[locale]/LC_MESSAGES/messages.po",
    "locale/[locale]/LC_MESSAGES/errors.po"
  ]
}

메시지 ID 잠금

"po": {
  "include": ["locale/[locale]/LC_MESSAGES/messages.po"],
  "lockedKeys": ["version", "copyright"]
}