lconvert 사용

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

이 도구는 다음 파일 형식을 지원합니다:

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

lconvert 구문

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

Where:

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

입력 파일을 여러 개 지정하면 이후 파일의 번역이 우선적으로 병합됩니다.

최신 lconvert 도움말을 보려면 입력합니다:

lconvert -help

l변환 옵션

옵션액션
-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"
)

© 2025 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.