update translations from transifex + minor corrections
[quassel.git] / po / CMakeLists.txt
index 9e1d70f..6879f03 100644 (file)
@@ -6,16 +6,20 @@ if(QT_LCONVERT_EXECUTABLE)
   set(LINGUAS "$ENV{LINGUAS}")
   string(REGEX REPLACE "[ \t]+" \; output "${LINGUAS}")
   # Find more languages
-  file(GLOB avail_pofiles *.po qt_*.po)
+  # We support xx.po and xx_YY.po, and additionally translations for qt using qt_xx.po or qt_xx_YY.po
+  file(GLOB avail_pofiles *.po)
   foreach(PO_FILE ${avail_pofiles})
     get_filename_component(basename ${PO_FILE} NAME_WE)
-    string(REGEX REPLACE "q[^_]+_([a-zA-Z]+)(_.+)?$" "\\1" lang ${basename})
-    # test if we want this
+    # CMake can't use MATCH to get the second catch...
+    string(REGEX REPLACE "(qt_)?([a-zA-Z]+)(_.+)?$" "\\2" lang ${basename})
+
+    # test if we want this language
     set(flg 1)
     if(LINGUAS)
       string(REGEX MATCH "${lang}" flg ${LINGUAS})
     endif(LINGUAS)
     if(flg)
+      generate_ts(QM ${basename})
       generate_qm(QM ${basename})
       list(APPEND qm_files ${QM})
       list(APPEND gen_linguas ${lang})
@@ -29,18 +33,20 @@ else(QT_LCONVERT_EXECUTABLE)
   message(STATUS "WARNING: lconvert not found, you won't have translations!")
 endif(QT_LCONVERT_EXECUTABLE)
 
-# For a static build, we need to include Qt translations if available
-if(STATIC AND QT_TRANSLATIONS_DIR)
-  foreach(LANG ${gen_linguas})
-    file(GLOB lang_files ${QT_TRANSLATIONS_DIR}/qt_${LANG}*.qm)
-    foreach(absfile ${lang_files})
-      get_filename_component(filename ${absfile} NAME)
-      message(STATUS "Importing ${filename}")
-      configure_file(${absfile} ${CMAKE_CURRENT_BINARY_DIR}/${filename} COPYONLY)
-      list(APPEND qm_files ${CMAKE_CURRENT_BINARY_DIR}/${filename})
-    endforeach(absfile ${lang_files})
-  endforeach(LANG ${gen_linguas})
-endif(STATIC AND QT_TRANSLATIONS_DIR)
+# For a static or win32 build, we need to include Qt translations if available
+if(QT_TRANSLATIONS_DIR)
+  if(STATIC OR WIN32)
+    foreach(LANG ${gen_linguas})
+      file(GLOB lang_files ${QT_TRANSLATIONS_DIR}/qt_${LANG}*.qm)
+      foreach(absfile ${lang_files})
+        get_filename_component(filename ${absfile} NAME)
+        message(STATUS "Importing ${filename}")
+        configure_file(${absfile} ${CMAKE_CURRENT_BINARY_DIR}/${filename} COPYONLY)
+        list(APPEND qm_files ${CMAKE_CURRENT_BINARY_DIR}/${filename})
+      endforeach(absfile ${lang_files})
+    endforeach(LANG ${gen_linguas})
+  endif(STATIC OR WIN32)
+endif(QT_TRANSLATIONS_DIR)
 
 # Write resource file
 set(resfile ${CMAKE_CURRENT_BINARY_DIR}/i18n.qrc)