Files
opu/po/CMakeLists.txt
T
yann64andClaude Opus 5.5 155545660e
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run
Haiku: native Interface Kit user interface
Same workflow as the GTK interface: vehicle list, adding a vehicle by VIN,
available updates, download folder, resumable download with progress, USB
stick selection with an erase confirmation, writing, installation guide.
Also a Preferences window (folder, language, automatic new-version check),
an About window and the manual new-version check.

Worker threads post closures to the window through a non-blocking queue
(BMessenger with a zero timeout). Translations use gettext with the GTK
catalogs; the default language comes from the Locale preferences. The
executable gets its signature and version from a generated .rdef.

Validated in the Haiku R1/beta6 VM against a mock Majestic server: full
flow down to a FAT32 stick with license/, both archives and no
UpdateInfo.xml; French interface; GitHub new-version check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
2026-11-29 05:56:25 +01:00

30 lines
1.3 KiB
CMake

# Translations (gettext). Source strings are English; add a language by adding <lang>.po and
# listing it in LINGUAS.
find_package(Gettext)
if(NOT GETTEXT_FOUND)
message(WARNING "gettext (msgfmt) not found: translations are not built")
return()
endif()
file(STRINGS LINGUAS OPENPU_LINGUAS REGEX "^[^#]")
foreach(lang IN LISTS OPENPU_LINGUAS)
set(mo ${CMAKE_BINARY_DIR}/locale/${lang}/LC_MESSAGES/openpu.mo)
add_custom_command(OUTPUT ${mo}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/locale/${lang}/LC_MESSAGES
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${mo} ${CMAKE_CURRENT_SOURCE_DIR}/${lang}.po
DEPENDS ${lang}.po)
list(APPEND OPENPU_MO_FILES ${mo})
install(FILES ${mo} DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${lang}/LC_MESSAGES)
endforeach()
add_custom_target(translations ALL DEPENDS ${OPENPU_MO_FILES})
# `cmake --build . --target pot` refreshes the template from the sources.
find_program(XGETTEXT xgettext)
if(XGETTEXT)
add_custom_target(pot
COMMAND ${XGETTEXT} --keyword=_ --keyword=N_ --from-code=UTF-8 --package-name=openpu
--add-comments=TRANSLATORS -o ${CMAKE_CURRENT_SOURCE_DIR}/openpu.pot
${PROJECT_SOURCE_DIR}/src/ui-gtk/main_window.cpp
${PROJECT_SOURCE_DIR}/src/ui-haiku/main_window.cpp
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
endif()