[vlmc-devel] commit: ts/CMakeLists.txt: Fixes #114. (Rohit Yadav )

git at videolan.org git at videolan.org
Mon Oct 4 08:48:08 CEST 2010


vlmc | branch: master | Rohit Yadav <rohityadav89 at gmail.com> | Mon Oct  4 12:31:48 2010 +0530| [9769dff7be7db9352c97c1b6eb6db4362db31cc4] | committer: Rohit Yadav 

ts/CMakeLists.txt: Fixes #114.
Translations can be selected using lang tokens:
cmake -DLANGS=<list of langs tokens separated by space> <path to root cmake list file>
For example: cmake -DLANGS="es fr ru uk" ..

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=9769dff7be7db9352c97c1b6eb6db4362db31cc4
---

 ts/CMakeLists.txt |   54 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/ts/CMakeLists.txt b/ts/CMakeLists.txt
index 6cc87d3..150a64d 100644
--- a/ts/CMakeLists.txt
+++ b/ts/CMakeLists.txt
@@ -1,3 +1,8 @@
+#
+# VLMC build system
+# Authors: Ludovic Fauvet <etix at vlmc.org>
+#          Rohit Yadav <rohityadav89 at gmail.com>
+#
 
 ## RCC file
 SET(TS_QRC ${CMAKE_SOURCE_DIR}/ts/resources-ts.qrc)
@@ -36,8 +41,53 @@ MACRO(QT4_ADD_TRANSLATIONS outfiles)
     FILE(APPEND ${TS_QRC} "</qresource></RCC>")
 ENDMACRO(QT4_ADD_TRANSLATIONS)
 
-## Collect all translations files
-FILE (GLOB vlmc_TS ${CMAKE_SOURCE_DIR}/ts/vlmc*.ts)
+## Set availbale translations file ids here
+OPTION(LANGUAGES "Using translations")
+SET(ALL_LANGUAGES
+        ca
+        cs
+        de
+        es
+        fr
+        gl
+        it
+        ja
+        nl
+        pl
+        pt
+        ro
+        ru
+        sk
+        sv
+        ta
+        tr
+        uk
+        zh
+   )
+
+## Check if user has provided specific LANGS option
+IF(NOT DEFINED LANGS)
+    SET(LANGUAGES ${ALL_LANGUAGES} CACHE STRING "Using translations" FORCE)
+ELSE(NOT DEFINED LANGS)
+    IF(NOT LANGS)
+        SET(LANGUAGES "" CACHE STRING "Using translations" FORCE)
+    ELSEIF(LANGS STREQUAL *)
+        SET(LANGUAGES ${ALL_LANGUAGES} CACHE STRING "Using translations" FORCE)
+    ELSE(NOT LANGS)
+        STRING(REGEX MATCHALL [a-zA-Z_]+
+               langs1 ${LANGS})
+        SET(LANGUAGES ${langs1} CACHE STRING "Using translations" FORCE)
+    ENDIF(NOT LANGS)
+ENDIF(NOT DEFINED LANGS)
+
+## Display what translations files will be processed
+MESSAGE(STATUS "Translations: ${LANGUAGES}")
+
+## Collect all translations files that are to be processed
+FOREACH(LANGUAGE ${LANGUAGES})
+    FILE(GLOB temp_TS ${CMAKE_SOURCE_DIR}/ts/vlmc*${LANGUAGE}*.ts)
+    LIST(APPEND vlmc_TS ${temp_TS})
+ENDFOREACH()
 
 IF(QT_LRELEASE_EXECUTABLE)
     ## Wraps the collected translations



More information about the Vlmc-devel mailing list