Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt: Add CMake target for generating translations #598

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,9 @@ if(NOT BUILD_HYDRA_CORE AND NOT BUILD_LIBRETRO_CORE)
if(NOT ENABLE_OPENGL)
message(FATAL_ERROR "Qt frontend requires OpenGL")
endif()

option(GENERATE_QT_TRANSLATION "Generate Qt translation file" OFF)
set(QT_LANGUAGES docs/translations)

set(FRONTEND_SOURCE_FILES src/panda_qt/main.cpp src/panda_qt/screen.cpp src/panda_qt/main_window.cpp src/panda_qt/about_window.cpp
src/panda_qt/config_window.cpp src/panda_qt/zep.cpp src/panda_qt/text_editor.cpp src/panda_qt/cheats_window.cpp src/panda_qt/mappings.cpp
Expand Down Expand Up @@ -556,6 +559,17 @@ if(NOT BUILD_HYDRA_CORE AND NOT BUILD_LIBRETRO_CORE)
endif()
endif()

# Generates an en.ts file for translations
# To update the file, use cmake --build --target Alber_lupdate
if(GENERATE_QT_TRANSLATION)
find_package(Qt6 REQUIRED COMPONENTS LinguistTools)
qt_add_lupdate(Alber TS_FILES ${QT_LANGUAGES}/en.ts
SOURCES ${FRONTEND_SOURCE_FILES}
INCLUDE_DIRECTORIES ${FRONTEND_HEADER_FILES}
NO_GLOBAL_TARGET
)
endif()

qt_add_resources(AlberCore "app_images"
PREFIX "/"
FILES
Expand Down
Loading