]> git.lyx.org Git - lyx.git/blobdiff - po/CMakeLists.txt
* sk.po
[lyx.git] / po / CMakeLists.txt
index 8b972e61c855c2d50c11b0538c204a3b98e6b3d3..5b0b46a12b49c869736bf46fe1294dc9c39cf1b6 100755 (executable)
@@ -51,6 +51,7 @@ macro(add_gettext_python  _par _dir)
       COMMENT "${LYX_PYTHON_EXECUTABLE} ${TOP_SRC_DIR}/po/lyx_pot.py -b ${TOP_SRC_DIR} -o  ${_dst} -t ${_par1} --src_file=${_src_files}"
       )
     ADD_CUSTOM_TARGET(layouttranslations1 DEPENDS "${_dst}")
+       set_target_properties(layouttranslations1 PROPERTIES FOLDER "i18n")
     if (LYX_DATA_SUBDIR STREQUAL "")
       install(FILES "${TOP_SRC_DIR}/lib/layouttranslations" DESTINATION .)
     else()
@@ -78,6 +79,7 @@ SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot" GENERA
 add_gettext_python(qt4 src/frontends/qt4/ui *.ui)
 add_gettext_python(layouts lib/layouts *.layout *.inc *.module)
 add_gettext_python(languages lib languages)
+add_gettext_python(latexfonts lib latexfonts)
 add_gettext_python(encodings lib encodings)
 add_gettext_python(ui lib/ui *.ui *.inc)
 add_gettext_python(external lib external_templates)
@@ -87,9 +89,9 @@ add_gettext_python(layouttranslations lib/layouts *.layout *.inc *.module)
 ADD_CUSTOM_COMMAND(
     OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot"
     COMMAND ${LYX_PYTHON_EXECUTABLE}
-    ARGS   "${TOP_SRC_DIR}/development/cmake/po/cat.py" ${_py_sources} > "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot"
+    ARGS   "${TOP_CMAKE_PATH}/po/cat.py" ${_py_sources} > "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot"
     COMMAND ${LYX_PYTHON_EXECUTABLE}
-      ARGS   "${TOP_SRC_DIR}/development/cmake/po/dos2unix.py" "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot"
+      ARGS   "${TOP_CMAKE_PATH}/po/dos2unix.py" "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot"
     DEPENDS ${_py_sources}
     )
 
@@ -119,20 +121,42 @@ ADD_CUSTOM_COMMAND(
     OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot"
     COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.fmt.pot" "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot"
     COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE}
-    ARGS --default-domain=${_lyxname} --directory=${TOP_SRC_DIR} --add-comments=TRANSLATORS: --language=C++ --join-existing --keyword=_ --keyword=N_ --keyword=B_ --keyword=qt_ --files-from="${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in" --copyright-holder="LyX Developers" --msgid-bugs-address=lyx-devel@lists.lyx.org -o "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot"
+      --default-domain=${_lyxname} --directory=${TOP_SRC_DIR}
+      --add-comments=TRANSLATORS:
+      --language=C++ --join-existing --keyword=_ --keyword=N_ --keyword=B_ --keyword=qt_
+      --files-from=${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in
+      --copyright-holder="LyX Developers" --msgid-bugs-address=lyx-devel@lists.lyx.org
+      -o "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot"
     DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.fmt.pot" ${_potfiles_dep}
     )
 
 #
 # We have to copy the po-files first,
 # otherwise they would be modified (inside the macro GETTEXT_CREATE_TRANSLATIONS())
-# This makes the "svn up" on po-files work again
+# This makes the "git pull" on po-files work again
 file(GLOB LYX_BASE_PO_FILES RELATIVE ${TOP_SRC_DIR}/po ${TOP_SRC_DIR}/po/*.po)
+list(SORT LYX_BASE_PO_FILES)
 set(LYX_PO_FILES)
 SET(LYX_UPDATED_PO_FILES)
 SET(LYX_DEST_PO ${TOP_SRC_DIR}/po)
 
+set(CONFIGURED_LANGUAGES)              # from file LINGUAS
+set(INSTALLED_LANGUAGES)               # from names of existing po-files
+
+file(STRINGS "${TOP_SRC_DIR}/po/LINGUAS" _lang_lines)
+foreach(_c_l ${_lang_lines})
+  if(NOT _c_l MATCHES "^#.*")
+    string(REPLACE " " ";" _c_l ${_c_l}) #Split ${_c_l}
+    list(APPEND CONFIGURED_LANGUAGES ${_c_l})
+  endif()
+endforeach(_c_l)
+
 foreach(_pofile ${LYX_BASE_PO_FILES})
+  string(REGEX REPLACE "^(.*)\\.po$" "\\1" _inst_lng ${_pofile})
+  list(FIND CONFIGURED_LANGUAGES ${_inst_lng} _lng_idx)
+  if(_lng_idx GREATER -1)
+    list(APPEND INSTALLED_LANGUAGES ${_inst_lng})
+  endif()
   add_custom_command(
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_pofile}
     COMMAND ${CMAKE_COMMAND} -E copy ${TOP_SRC_DIR}/po/${_pofile} ${CMAKE_CURRENT_BINARY_DIR}/${_pofile}
@@ -141,13 +165,25 @@ foreach(_pofile ${LYX_BASE_PO_FILES})
   list(APPEND LYX_PO_FILES ${CMAKE_CURRENT_BINARY_DIR}/${_pofile})
 endforeach(_pofile)
 
+set(LYX_UPDATED_GMO_FILES)
+foreach(_gmo_base ${INSTALLED_LANGUAGES})
+  set(_gmo ${_gmo_base}.gmo)
+  add_custom_command(
+    OUTPUT "${LYX_DEST_PO}/${_gmo}"
+    COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_BINARY_DIR}/${_gmo}" "${LYX_DEST_PO}/${_gmo}"
+    DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_gmo}"
+    )
+  list(APPEND LYX_UPDATED_GMO_FILES "${LYX_DEST_PO}/${_gmo}")
+  ADD_CUSTOM_TARGET(update-${_gmo_base}-gmo DEPENDS "${LYX_DEST_PO}/${_gmo}")
+endforeach()
+
 set(LYX_UPDATED_PO_FILES)
 foreach(_pofile ${LYX_BASE_PO_FILES})
   if(WIN32)
     add_custom_command(
       OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_pofile}.copied
       COMMAND ${LYX_PYTHON_EXECUTABLE}
-        ARGS   "${TOP_SRC_DIR}/development/cmake/po/unix2dos.py" "${CMAKE_CURRENT_BINARY_DIR}/${_pofile}"
+        ARGS   "${TOP_CMAKE_PATH}/po/unix2dos.py" "${CMAKE_CURRENT_BINARY_DIR}/${_pofile}"
       COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${_pofile} ${LYX_DEST_PO}/${_pofile}
       COMMAND ${CMAKE_COMMAND} -E touch ${_pofile}.copied
       DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_pofile}
@@ -170,6 +206,7 @@ GETTEXT_CREATE_TRANSLATIONS(${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot ${_addAL
 
 # Create a new target to remerge po files
 # ALL omitted here, to prevent from automatic creation
-ADD_CUSTOM_TARGET(update-po DEPENDS ${LYX_UPDATED_PO_FILES})
+ADD_CUSTOM_TARGET(update-po DEPENDS ${LYX_UPDATED_PO_FILES} ${LYX_UPDATED_GMO_FILES})
+set_target_properties(update-po PROPERTIES FOLDER "i18n")
 add_dependencies(update-po translations)