[vlmc-devel] Fix translations

Hugo Beauzée-Luyssen git at videolan.org
Sun Apr 17 18:21:14 CEST 2016


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Sun Apr 17 18:19:28 2016 +0200| [fb433b09831e7369d31b891ddc773d1d559623a9] | committer: Hugo Beauzée-Luyssen

Fix translations

> https://code.videolan.org/videolan/vlmc/commit/fb433b09831e7369d31b891ddc773d1d559623a9
---

 .gitignore            |  1 -
 src/CMakeLists.txt    | 12 ++++++------
 ts/.gitignore         |  1 -
 ts/translations.cmake | 10 ++++++++++
 4 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/.gitignore b/.gitignore
index 4be9886..52b4851 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,7 +9,6 @@ Makefile*
 
 /src/__/
 /src/config.h
-/src/qrc_resources-ts.cxx
 /src/qrc_resources.cxx
 /src/vlmc_automoc.cpp
 vlmc
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a7cee9c..0a28b24 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -96,10 +96,7 @@ ELSE (WIN32)
     LIST( APPEND VLMC_SRCS Main/vlmc.cpp )
 ENDIF(WIN32)
 
-SET(VLMC_RCC
-    ../resources.qrc
-    ../ts/resources-ts.qrc
-  )
+SET(VLMC_RCC ../resources.qrc)
 
 IF (WIN32)
     LIST( APPEND VLMC_RCC ../resources/styles.qrc )
@@ -243,9 +240,12 @@ ELSE(NOT WITH_GUI)
     ENDIF(WITH_CRASHHANDLER_GUI)
 
     qt5_wrap_ui(VLMC_UIS_H ${VLMC_UIS})
-    qt5_add_resources(VLMC_RCC_SRCS ${VLMC_RCC})
 
     vlmc_get_ts(VLMC_QMS)
+    vlmc_create_ts_resources("${VLMC_QMS}" "${CMAKE_CURRENT_BINARY_DIR}/ts-resource.qrc")
+    list(APPEND VLMC_RCC ${CMAKE_CURRENT_BINARY_DIR}/ts-resource.qrc)
+
+    qt5_add_resources(VLMC_RCC_SRCS ${VLMC_RCC})
 
     IF( MINGW )
         # resource compilation for MinGW
@@ -274,7 +274,7 @@ ELSE(NOT WITH_GUI)
         LIST( APPEND VLMC_SRCS Gui/preview/RenderWidget.h )
     ENDIF( APPLE )
 
-    ADD_EXECUTABLE( vlmc ${GUI_TYPE} ${VLMC_SRCS} ${VLMC_MOC_SRCS} ${VLMC_UIS_H} ${VLMC_RCC_SRCS} ${VLMC_QMS} )
+    ADD_EXECUTABLE( vlmc ${GUI_TYPE} ${VLMC_SRCS} ${VLMC_MOC_SRCS} ${VLMC_UIS_H} ${VLMC_RCC_SRCS} )
     TARGET_LINK_LIBRARIES( vlmc ${VLMC_LIBS} )
     if (NOT Qt4_FOUND)
         qt5_use_modules(vlmc Core Gui Widgets Network)
diff --git a/ts/.gitignore b/ts/.gitignore
index 40e0320..8df47d5 100644
--- a/ts/.gitignore
+++ b/ts/.gitignore
@@ -1,2 +1 @@
 *.qm
-resources-ts.qrc
diff --git a/ts/translations.cmake b/ts/translations.cmake
index 48e9bc1..653d428 100644
--- a/ts/translations.cmake
+++ b/ts/translations.cmake
@@ -72,3 +72,13 @@ function(vlmc_get_ts VLMC_QM_FILES_OUT)
         set(${VLMC_QM_FILES_OUT} "" PARENT_SCOPE)
     endif()
 endfunction()
+
+function(vlmc_create_ts_resources VLMC_QMS_IN VLMC_QRC_FILE_IN)
+    set(QRC_SRC "<RCC><qresource prefix=\"/ts\">")
+    foreach(qm ${VLMC_QMS_IN})
+        get_filename_component(QM_NAME ${qm} NAME)
+        set(QRC_SRC "${QRC_SRC} <file alias=\"${QM_NAME}\">${qm}</file>")
+    endforeach()
+    set(QRC_SRC "${QRC_SRC}</qresource></RCC>")
+    file(WRITE ${VLMC_QRC_FILE_IN} ${QRC_SRC})
+endfunction()



More information about the Vlmc-devel mailing list