ref: refs/heads/master
commit 52c0c42409a0adfd9d34a8e381ecebbac97ec3b0
Author: Michael Andres
Date: Thu Sep 17 18:05:20 2009 +0200
Add cmake target for preating po/zypp.pot
---
cmake/modules/FindGettext.cmake | 12 +++---------
po/CMakeLists.txt | 9 ++++++++-
po/createPot | 9 +++++----
3 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/cmake/modules/FindGettext.cmake b/cmake/modules/FindGettext.cmake
index cdbfc13..1b836a8 100644
--- a/cmake/modules/FindGettext.cmake
+++ b/cmake/modules/FindGettext.cmake
@@ -6,7 +6,7 @@
# GETTEXT_FOUND: True if gettext has been found.
#
# Additionally it provides the following macros:
-# GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN )
+# GETTEXT_CREATE_TRANSLATIONS ( _moBasename [ALL] file1 ... fileN )
# This will create a target "translations" which will convert the
# given input po files into the binary output mo file. If the
# ALL option is used, the translations will also be created when
@@ -16,13 +16,9 @@ FIND_PROGRAM(GETTEXT_MSGMERGE_EXECUTABLE msgmerge)
FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
-MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFile)
+MACRO(GETTEXT_CREATE_TRANSLATIONS _moBasename _firstPoFile)
SET(_gmoFiles)
- GET_FILENAME_COMPONENT(_potBasename ${_potFile} NAME_WE)
- GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE)
-
-#MESSAGE( STATUS "pot: ${_potFile} converted to ${_potBasename}")
SET(_addToAll)
IF(${_firstPoFile} STREQUAL "ALL")
@@ -38,13 +34,11 @@ MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFile)
ADD_CUSTOM_COMMAND(
OUTPUT ${_gmoFile}
-#COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile}
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
-#DEPENDS ${_absPotFile} ${_absFile}
DEPENDS ${_absFile}
)
- INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
+ INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_moBasename}.mo)
SET(_gmoFiles ${_gmoFiles} ${_gmoFile})
ENDFOREACH (_currentPoFile )
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index de2f444..98696cd 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -1,3 +1,10 @@
FILE( GLOB LIBZYPP_PO_FILES ${LIBZYPP_SOURCE_DIR}/po/*.po )
-GETTEXT_CREATE_TRANSLATIONS( "${LIBZYPP_SOURCE_DIR}/po/zypp.pot" ${LIBZYPP_PO_FILES} )
\ No newline at end of file
+GETTEXT_CREATE_TRANSLATIONS( "zypp" ${LIBZYPP_PO_FILES} )
+
+ADD_CUSTOM_TARGET( zypp.pot
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/createPot ${LIBZYPP_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/zypp.pot
+)
+SET_DIRECTORY_PROPERTIES( PROPERTIES
+ ADDITIONAL_MAKE_CLEAN_FILES zypp.pot
+)
diff --git a/po/createPot b/po/createPot
index 6900be6..5e679e1 100755
--- a/po/createPot
+++ b/po/createPot
@@ -1,12 +1,13 @@
#!/bin/bash
-
+LIBZYPP_SOURCE_DIR="${1:-..}"
+POTFILE="${2:-po/zypp.pot}"
# search for sourcecode-files
-SRCFILES=`find .. -type d -name testsuite -prune -o -name build -prune , \
+cd "$LIBZYPP_SOURCE_DIR"
+SRCFILES=`find examples tools zypp \
-type f -name "*.h" \
-o -name "*.pm" \
-o -name "*.c" \
-o -name "*.cc" \
-o -name "*.cpp"`
-echo $SRCFILES
#calling xgettext with the sourcefiles
-xgettext -s --no-wrap --add-comments --add-location --keyword=_ --keyword=_:1,2 --keyword=__ --keyword=N_ --foreign-user --copyright-holder="SuSE Linux Products GmbH, Nuernberg" --default-domain=libzypp --output=zypp.pot $SRCFILES
+xgettext -s --no-wrap --add-comments --add-location --keyword=_ --keyword=_:1,2 --keyword=__ --keyword=N_ --foreign-user --copyright-holder="SuSE Linux Products GmbH, Nuernberg" --default-domain=libzypp --output="$POTFILE" $SRCFILES
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org