이 페이지에서

lconvert 사용법

lconvert 명령줄 도구는 번역 데이터 파일을 필터링하고 변환합니다.

다음 파일 형식을 지원합니다:

  • pot - GNU Gettext 현지화 템플릿 파일
  • qph - Qt Linguist 구문집
  • ts - Qt 번역 소스
  • po - GNU Gettext 현지화 파일
  • qm - 컴파일된 Qt 번역
  • xlf - XLIFF 현지화 파일

lconvert 구문

lconvert [options] <infile> [<infile>...]

여기서:

  • options 는 하나 이상의 lconvert 옵션을 의미합니다.
  • infile 는 입력 파일입니다. 여러 개의 입력 파일을 지정할 수 있습니다.

여러 개의 입력 파일을 지정하면, 파일 순서대로 번역 내용이 병합되며, 뒤에 나오는 파일의 번역 내용이 우선 적용됩니다.

최신 lconvert 도움말을 보려면 다음을 입력하십시오:

lconvert -help

lconvert 옵션

옵션동작
-h
-help
Display up-to-date help information and exit.
-i <infile>
-input-file <infile>
Specify an input file. Use this option if <infile> starts with a dash. Use this option several times to merge inputs. May be - (standard input) for use in a pipe.
-o <outfile>
-output-file <outfile>
Specify an output file. Default is - (standard output).
-if <informat>
-input-format <format>
Specify input format for subsequent input files. The format is auto-detected from the file name and defaults to ts.
-of <outformat>
-output-format <outformat>
Specify output format. See -if.
-drop-tags <regexp>TS 또는 XLIFF 파일을 작성할 때 이름이 지정된 추가 태그를 제거합니다. 이 옵션을 여러 번 지정할 수 있습니다.
-drop-translations기존 번역을 삭제하고 상태를 unfinished 로 재설정합니다. 이는 --no-obsolete 를 의미합니다.
-source-language <language>[_<region>]소스 문자열의 언어를 지정하거나 재정의합니다. 지정하지 않았고 파일 이름에도 언어가 명시되지 않은 경우 기본값은 POSIX입니다.
-target-language <language>[_<region>]번역의 언어를 지정하거나 재정의합니다. 기본적으로 대상 언어는 파일 내용에서 읽히거나 파일 이름에서 추측됩니다.
-no-obsolete사용되지 않는 메시지를 제거합니다.
-no-finished완료된 메시지를 제거합니다.
-no-untranslated번역되지 않은 메시지를 제거합니다.
-sort-contexts출력된 ` TS ` 파일에서 컨텍스트를 알파벳순으로 정렬합니다.
-sort-messagesTS 파일에서 컨텍스트 내 메시지를 알파벳순으로 정렬합니다.
-locations {absolute|relative|none}TS 파일에서 소스 코드 참조가 저장되는 방식을 재정의합니다. 기본값은 absolute 입니다.
-no-ui-linesUI 파일에 대한 참조에서 줄 번호를 생략합니다.
-pluralonly복수형이 아닌 형태의 메시지를 생략합니다.
-verbose현재 수행 중인 작업을 설명합니다.

예시

TS 파일을 XLIFF로 변환

단일 TS 파일을 XLIFF로 변환하려면 터미널에서 다음 명령을 실행하십시오:

lconvert -o myapp_de.xlf myapp_de.ts

여러 QM 파일 병합

다음 명령어는 여러 QM 파일을 ` full_de.qm` 파일로 병합합니다:

lconvert -o full_de.qm qtbase_de.qm myapp_de.qm mylib_de.qm

CMake에서 lconvert 사용하기

CMake 프로젝트를 구성하거나 빌드할 때 lconvert 를 호출하려면, Qt6LinguistTools 패키지를 로드하고 $<TARGET_FILE_NAME:Qt6::lconvert> 를 사용하여 lconvert 실행 파일을 찾아야 합니다.

다음 예제는 단일 TS 파일을 XLIFF로 변환하는 사용자 정의 타깃 xlf_de 를 추가합니다.

find_package(Qt6 REQUIRED COMPONENTS LinguistTools)

add_custom_command(
    OUTPUT myapp_de.xlf
    COMMAND $<TARGET_FILE:Qt6::lconvert> -o myapp_de.xlf myapp_de.ts
    DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/myapp_de.ts"
    VERBATIM
)

add_custom_target(xlf_de
    DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/myapp_de.xlf"
)

PO 형식별 옵션

PO 형식으로 변환할 때, po-flags 의 추가 메타데이터 필드에 no-wrap 플래그를 설정하여 자동 줄 바꿈을 비활성화할 수 있습니다. 기본적으로 79자보다 긴 줄은 줄 바꿈됩니다. 이 필드는 소스 코드에서 //~ 메타 문자열 (예: //~ po-flags no-wrap)을 사용하여 설정하거나, TS 파일에서 <extra-po-flags> 요소를 사용하여 직접 설정할 수 있습니다.

다른 PO 플래그( GNU gettext 문서 참조)는 TS와 PO 형식 간 변환 시 유지되지만, lconvert 처리에는 영향을 미치지 않습니다.

참고: po-flags 메타데이터는 TS에서 PO 형식으로 직접 변환할 때만 보존됩니다.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.