mirror of
https://github.com/altlinux/admc.git
synced 2025-01-09 17:18:15 +03:00
improve translation build process
make it the same for admc and adldap move admc translation files to admc dir delete translations dir move translations.qrc into admc.qrc
This commit is contained in:
parent
4c131e521e
commit
7899968b80
@ -25,7 +25,6 @@ set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
|
||||
|
||||
enable_testing()
|
||||
|
||||
add_subdirectory(translations)
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(tests)
|
||||
add_subdirectory(doc)
|
||||
|
@ -13,20 +13,6 @@ find_package(Resolv REQUIRED)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(TS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
set(TS_FILES
|
||||
${TS_DIR}/adldap_ru.ts
|
||||
${TS_DIR}/adldap_en.ts
|
||||
)
|
||||
|
||||
set(QM_FILES
|
||||
${TS_DIR}/adldap_ru.qm
|
||||
${TS_DIR}/adldap_en.qm
|
||||
)
|
||||
|
||||
|
||||
|
||||
add_library(adldap SHARED
|
||||
ad_interface.cpp
|
||||
ad_config.cpp
|
||||
@ -51,20 +37,23 @@ target_link_libraries(adldap
|
||||
Resolv::Resolv
|
||||
)
|
||||
|
||||
# Generate translation binaries (.qm) from sources (.ts)
|
||||
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${TS_DIR})
|
||||
qt5_add_translation(QM_FILES ${TS_FILES})
|
||||
set(TS_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/adldap_ru.ts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/adldap_en.ts
|
||||
)
|
||||
|
||||
# NOTE: updating translations(.cpp -> .ts) is in a separate target so that it's not run every time source changes. When you do need to update translations, do `make update_translations`. *Generating* translations IS done every time (.ts -> .qm).
|
||||
|
||||
add_custom_target(update_adldap_translations
|
||||
# NOTE: custom target to update translation sources (.ts).
|
||||
# By default, translation sources aren't updated so you have
|
||||
# to manually make this target to commit translation
|
||||
# changes.
|
||||
add_custom_target(adldap_ts
|
||||
DEPENDS ${TS_FILES}
|
||||
COMMAND ${Qt5_LUPDATE_EXECUTABLE} -recursive ${CMAKE_CURRENT_SOURCE_DIR} -ts ${TS_FILES} -noobsolete
|
||||
)
|
||||
|
||||
add_custom_target(adldap_translations
|
||||
ALL
|
||||
DEPENDS ${QM_FILES}
|
||||
)
|
||||
# Generate translation binaries (.qm) from sources (.ts)
|
||||
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
qt5_create_translation(QM_FILES ${CMAKE_CURRENT_SOURCE_DIR} ${TS_FILES})
|
||||
|
||||
|
||||
install(TARGETS adldap)
|
||||
|
@ -3,6 +3,7 @@ find_package(Qt5 REQUIRED
|
||||
Core
|
||||
Widgets
|
||||
Help
|
||||
LinguistTools
|
||||
)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
@ -96,7 +97,6 @@ add_executable(admc
|
||||
console_widget/console_drag_model.cpp
|
||||
|
||||
admc.qrc
|
||||
${PROJECT_SOURCE_DIR}/translations/translations.qrc
|
||||
)
|
||||
|
||||
target_include_directories(admc
|
||||
@ -113,4 +113,22 @@ target_link_libraries(admc
|
||||
adldap
|
||||
)
|
||||
|
||||
set(TS_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/admc_ru.ts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/admc_en.ts
|
||||
)
|
||||
|
||||
# NOTE: custom target to update translation sources (.ts).
|
||||
# By default, translation sources aren't updated so you have
|
||||
# to manually make this target to commit translation
|
||||
# changes.
|
||||
add_custom_target(admc_ts
|
||||
DEPENDS ${TS_FILES}
|
||||
COMMAND ${Qt5_LUPDATE_EXECUTABLE} -recursive ${CMAKE_CURRENT_SOURCE_DIR} -ts ${TS_FILES} -noobsolete
|
||||
)
|
||||
|
||||
# Generate translation binaries (.qm) from sources (.ts)
|
||||
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
qt5_create_translation(QM_FILES ${CMAKE_CURRENT_SOURCE_DIR} ${TS_FILES})
|
||||
|
||||
install(TARGETS admc)
|
||||
|
@ -1,5 +1,7 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<qresource prefix="/admc/">
|
||||
<file alias="countries.csv">data/countries.csv</file>
|
||||
<file>admc_ru.qm</file>
|
||||
<file>admc_en.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -44,7 +44,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
QTranslator translator;
|
||||
const QLocale saved_locale = SETTINGS()->get_variant(VariantSetting_Locale).toLocale();
|
||||
translator.load(saved_locale, QString(), QString(), ":/translations");
|
||||
translator.load(saved_locale, QString(), QString(), ":/admc");
|
||||
load_adldap_translation(translator, saved_locale);
|
||||
app.installTranslator(&translator);
|
||||
|
||||
|
@ -43,7 +43,6 @@ add_executable(gpgui
|
||||
gui/xml/xml_ubyte_edit.cpp
|
||||
|
||||
gpgui.qrc
|
||||
${PROJECT_SOURCE_DIR}/translations/translations.qrc
|
||||
)
|
||||
|
||||
if(SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
|
@ -89,7 +89,6 @@ set(TEST_SOURCES
|
||||
${PROJECT_SOURCE_DIR}/src/admc/settings.cpp
|
||||
|
||||
${PROJECT_SOURCE_DIR}/src/admc/admc.qrc
|
||||
${PROJECT_SOURCE_DIR}/translations/translations.qrc
|
||||
)
|
||||
|
||||
# NOTE: ADD ALL TESTS TO THIS LIST
|
||||
|
@ -1,33 +0,0 @@
|
||||
find_package(Qt5 REQUIRED
|
||||
COMPONENTS
|
||||
Core # needed for some cmake macros
|
||||
LinguistTools
|
||||
)
|
||||
|
||||
set(TS_DIR ${PROJECT_SOURCE_DIR}/translations)
|
||||
|
||||
set(TS_FILES
|
||||
${TS_DIR}/ru.ts
|
||||
${TS_DIR}/en.ts
|
||||
)
|
||||
|
||||
set(QM_FILES
|
||||
${TS_DIR}/ru.qm
|
||||
${TS_DIR}/en.qm
|
||||
)
|
||||
|
||||
# Generate translation binaries (.qm) from sources (.ts)
|
||||
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${TS_DIR})
|
||||
qt5_add_translation(QM_FILES ${TS_FILES})
|
||||
|
||||
# NOTE: updating translations(.cpp -> .ts) is in a separate target so that it's not run every time source changes. When you do need to update translations, do `make update_translations`. *Generating* translations IS done every time (.ts -> .qm).
|
||||
|
||||
add_custom_target(update_translations
|
||||
DEPENDS ${TS_FILES}
|
||||
COMMAND ${Qt5_LUPDATE_EXECUTABLE} -recursive ${PROJECT_SOURCE_DIR}/src/admc -ts ${TS_FILES} -noobsolete
|
||||
)
|
||||
|
||||
add_custom_target(translations
|
||||
ALL
|
||||
DEPENDS ${QM_FILES}
|
||||
)
|
@ -1,6 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/translations/">
|
||||
<file>ru.qm</file>
|
||||
<file>en.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
Loading…
Reference in New Issue
Block a user