Fix duplicate strings in gettext translations
[quassel.git] / po / CMakeLists.txt
index d0efe9b..9f8b2b2 100644 (file)
@@ -2,24 +2,24 @@
 # The LINGUAS variable can be used to limit that set
 
 if(QT_LCONVERT_EXECUTABLE)
-  # We always include quassel.po
-  generate_qm(QM quassel)
-  set(qm_files ${QM})
-
   # get environment variable for translations
   set(LINGUAS "$ENV{LINGUAS}")
   string(REGEX REPLACE "[ \t]+" \; output "${LINGUAS}")
   # Find more languages
-  file(GLOB avail_pofiles quassel_*.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})
@@ -65,4 +65,4 @@ else(EMBED_DATA)
   install(FILES ${qm_files} DESTINATION ${DATA_INSTALL_DIR}/quassel/translations)
 endif(EMBED_DATA)
 
-add_custom_target(i18n DEPENDS ${qm_files})
+add_custom_target(po DEPENDS ${qm_files})