qt_create_translation

Qt Linguist 번역 툴체인을 설정합니다.

이 명령은 Qt6 패키지의 LinguistTools 구성 요소에 정의되어 있습니다. 패키지를 로드합니다:

find_package(Qt6 REQUIRED COMPONENTS LinguistTools)

경고: 이 함수는 더 이상 사용되지 않습니다. 대신 대상 기반 함수인 qt6_add_lupdate 또는 qt6_add_translations를 사용하는 것을 고려하세요.

개요

qt_create_translation(<VAR> ts-file-or-sources [ts-file-or-sources2 ...]
                      [OPTIONS ...])

버전 없는 명령이 비활성화되어 있으면 qt6_create_translation 을 대신 사용합니다. 이 명령과 동일한 인수 집합을 지원합니다.

설명

지정된 소스(디렉터리 또는 개별 파일)를 처리하여 Qt Linguist .ts 파일을 생성합니다. .ts 파일은 차례로 빌드 디렉터리에 저장되는 동일한 기본 이름의 .qm 파일로 컴파일됩니다. 생성된 .qm 파일의 경로는 <VAR> 에 추가됩니다.

생성하거나 업데이트할 번역 파일에는 .ts 접미사가 있어야 합니다. 지정된 파일 경로가 절대 경로가 아닌 경우 현재 소스 디렉터리를 기준으로 확인됩니다. .ts 파일이 인자로 전달되지 않으면 매크로는 아무 작업도 수행하지 않습니다.

.ts 접미사가 없는 인수는 lupdate 에 입력으로 전달됩니다. lupdate 은 디렉터리와 소스 파일을 입력으로 받습니다. 자세한 내용은 업데이트 문서를 참조하세요.

옵션

lupdate 호출 시 전달할 OPTIONS 을 추가로 설정할 수 있습니다. 사용 가능한 옵션은 업데이트 문서에서 확인할 수 있습니다.

예제

현재 디렉터리에 있는 소스 파일에서 Qt 번역을 재귀적으로 조회하고 lupdate 을 사용하여 helloworld_en.tshelloworld_de.ts 파일을 생성하거나 업데이트합니다. 해당 파일을 빌드 디렉터리에 있는 helloworld_en.qmhelloworld.de.qm 파일로 컴파일합니다:

qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} helloworld_en.ts helloworld_de.ts)

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