이 페이지에서

qt_create_translation

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

이 명령은 Qt6 패키지의 LinguistTools 구성 요소에 정의되어 있습니다. 다음 명령으로 패키지를 불러오세요:

find_package(Qt6 REQUIRED COMPONENTS LinguistTools)

경고: 이 함수는 더 이상 사용되지 않습니다. 대신 대상 기반 함수인 qt_add_lupdate() 또는 qt_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 설명서를 참조하십시오.

옵션

lupdate 가 호출될 때 전달되어야 할 추가 OPTIONS 을 설정할 수 있습니다. 사용 가능한 옵션은 lupdate 문서에서 확인할 수 있습니다.

예시

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

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

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