diff ui/CMakeLists.txt @ 420:16b6d5686835

Switch to resource based loading of translations
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 16 Apr 2014 17:00:59 +0000
parents 413b29f6758f
children 7edfc9b9b360
line wrap: on
line diff
--- a/ui/CMakeLists.txt	Wed Apr 16 16:05:46 2014 +0000
+++ b/ui/CMakeLists.txt	Wed Apr 16 17:00:59 2014 +0000
@@ -112,11 +112,21 @@
 qt5_add_resources(ADMINSTRATOR_SOURCES_WITH_RESOURCES ${ADMINSTRATOR_RESOURCES})
 
 if(Qt5LinguistTools_FOUND)
+   # Include translation as a resource
+   # This works in the source directory to enable the rcc dependencies to be found
+   # and it also updates the currently available localization.
+   # This would probably be better placed in a macro
+   configure_file(l10n/administrator.qrc.in administrator.qrc)
+   qt5_add_resources(ADMINISTRATOR_L10N ${CMAKE_CURRENT_BINARY_DIR}/administrator.qrc)
    qt5_create_translation(ADMINISTRATOR_TRANSLATION ${ADMINSTRATOR_SOURCES_WITH_RESOURCES}
-      ${CMAKE_CURRENT_SOURCE_DIR}/l10n/administrator.ts)
-  add_executable(administrator ${ADMINSTRATOR_SOURCES_WITH_RESOURCES} ${ADMINISTRATOR_TRANSLATION})
+      ${CMAKE_CURRENT_SOURCE_DIR}/l10n/administrator_de_DE.ts)
+   add_executable(administrator ${ADMINSTRATOR_SOURCES_WITH_RESOURCES}
+      ${ADMINISTRATOR_L10N}
+      ${ADMINISTRATOR_TRANSLATION}
+      )
 else()
-   message (STATUS "WARNING: Could not find qt linguist tools. Translation will not be included.")
+  message (STATUS "WARNING: Could not find qt linguist tools. Translation will not be included.")
+  add_executable(administrator ${ADMINSTRATOR_SOURCES_WITH_RESOURCES})
 endif()
 
 target_link_libraries(administrator Qt5::Widgets

http://wald.intevation.org/projects/trustbridge/