summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-08-29 20:44:47 +0300
committerAndrei Karas <akaras@inbox.ru>2011-08-29 20:44:47 +0300
commit6ed12d65e030bd2deb92b037f4a831e9ed17f3e0 (patch)
tree064d0f31aae57a35411793fd8fdca8fe5fa719cc
parentfa57505d930970d38b5f1001f2bfac3a9a45795a (diff)
downloadManaVerse-6ed12d65e030bd2deb92b037f4a831e9ed17f3e0.tar.gz
ManaVerse-6ed12d65e030bd2deb92b037f4a831e9ed17f3e0.tar.bz2
ManaVerse-6ed12d65e030bd2deb92b037f4a831e9ed17f3e0.tar.xz
ManaVerse-6ed12d65e030bd2deb92b037f4a831e9ed17f3e0.zip
Build only selected translations in cmake.
Using commits from mana: 9d31c7136b2c6f6c6a1ac5909ff6c7b4cc42574c and 5b277b71cd2092767bcc99bf0e107a53dc9c7918 by Bernd Wachter.
-rw-r--r--po/CMakeLists.txt46
1 files changed, 43 insertions, 3 deletions
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index de35788eb..068757ac1 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -33,10 +33,50 @@ MACRO(MANAPLUS_GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
SET(_gmoFiles ${_gmoFiles} ${_gmoFile})
- ENDFOREACH (_currentPoFile )
+ ENDFOREACH (_currentPoFile)
ADD_CUSTOM_TARGET(translations ${_addToAll} DEPENDS ${_gmoFiles})
-ENDMACRO(MANAPLUS_GETTEXT_CREATE_TRANSLATIONS )
+ENDMACRO()
+
+MACRO(MANAPLUS_GETTEXT_UPDATE_PO _potFile _languages)
+ GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE)
+
+ ADD_CUSTOM_TARGET(
+ update-pot
+ COMMAND xgettext --files-from=translatable-files --directory=. --output=${_potFile} -d manaplus --keyword=_ --keyword=N_
+ )
+
+ ADD_CUSTOM_TARGET(
+ update-translatable-files
+ COMMAND grep '_\(' -Irl ../src | sort > translatable-files
+ )
+
+ FOREACH(_lang ${_languages})
+ GET_FILENAME_COMPONENT(_absFile "${_lang}.po" ABSOLUTE)
+ SET(_currentPoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po)
+ ADD_CUSTOM_TARGET(
+ "update-translation-${_lang}"
+ COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile}
+ )
+ ADD_DEPENDENCIES("update-translation-${_lang}" update-pot)
+ ADD_DEPENDENCIES(update-po "update-translation-${_lang}")
+ ADD_DEPENDENCIES(update-pot update-translatable-files)
+ ENDFOREACH()
+ENDMACRO()
+
+
+SET(languages)
+SET(POFILES)
+FILE(STRINGS LINGUAS _languages)
+FOREACH(_lang ${_languages})
+ STRING(REGEX REPLACE "#.*" "" _lang "${_lang}")
+ IF(NOT ${_lang} STREQUAL "")
+ SET(languages ${languages} ${_lang})
+ SET(POFILES ${POFILES} "${_lang}.po")
+ ENDIF()
+ENDFOREACH()
+
+ADD_CUSTOM_TARGET(update-po)
-FILE(GLOB POFILES *.po)
MANAPLUS_GETTEXT_CREATE_TRANSLATIONS(manaplus.pot ALL ${POFILES})
+MANAPLUS_GETTEXT_UPDATE_PO(manaplus.pot "${languages}")